Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

virt attach can specify command #235

Merged
merged 3 commits into from
Aug 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions engine/virt/virt.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func (v *Virt) ExecAttach(ctx context.Context, execID string, tty bool) (io.Read
func (v *Virt) Execute(ctx context.Context, target string, config *enginetypes.ExecConfig) (execID string, outputStream io.ReadCloser, inputStream io.WriteCloser, err error) {
if config.Tty {
flags := virttypes.AttachGuestFlags{Safe: true, Force: true}
stream, err := v.client.AttachGuest(ctx, target, flags)
stream, err := v.client.AttachGuest(ctx, target, config.Cmd, flags)
if err != nil {
return "", nil, nil, err
}
Expand All @@ -104,7 +104,7 @@ func (v *Virt) ExecExitCode(ctx context.Context, execID string) (code int, err e

// ExecResize resize exec tty
func (v *Virt) ExecResize(ctx context.Context, execID string, height, width uint) (err error) {
resizeCmd := fmt.Sprintf("/bin/stty -F /dev/ttyS0 rows %d cols %d", height, width)
resizeCmd := fmt.Sprintf("yaexec resize -r %d -c %d", height, width)
msg, err := v.client.ExecuteGuest(ctx, execID, strings.Split(resizeCmd, " "))
log.Debugf("[ExecResize] resize got response: %v", msg)
return err
Expand Down
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ require (
github.com/opencontainers/runc v0.0.0-20180615140650-ad0f5255060d // indirect
github.com/patrickmn/go-cache v2.1.0+incompatible
github.com/pkg/errors v0.9.1
github.com/projecteru2/libyavirt v0.0.0-20200706021408-b8f160e2f677
github.com/projecteru2/libyavirt v0.0.0-20200803015801-c31d39b6e15c
github.com/prometheus/client_golang v1.0.0
github.com/sanity-io/litter v1.1.0
github.com/sirupsen/logrus v1.4.2
Expand All @@ -39,6 +39,7 @@ require (
golang.org/x/net v0.0.0-20200319234117-63522dbf7eec
golang.org/x/time v0.0.0-20191024005414-555d28b269f0 // indirect
golang.org/x/tools v0.0.0-20200612022331-742c5eb664c2 // indirect
google.golang.org/genproto v0.0.0-20200319113533-08878b785e9c // indirect
google.golang.org/grpc v1.28.0
gopkg.in/alexcesaro/statsd.v2 v2.0.0 // indirect
gopkg.in/yaml.v2 v2.3.0 // indirect
Expand Down
3 changes: 3 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
Expand Down Expand Up @@ -190,6 +191,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/projecteru2/libyavirt v0.0.0-20200706021408-b8f160e2f677 h1:ui8PkAHl3RS1wKLaw+LprXXhrEULBUJHuGFzEB+je70=
github.com/projecteru2/libyavirt v0.0.0-20200706021408-b8f160e2f677/go.mod h1:L+QcwDnJUIQYX7mM9//2KNF32e1aknOFFzutbVNyKfg=
github.com/projecteru2/libyavirt v0.0.0-20200803015801-c31d39b6e15c h1:I9i6hagi+VJ3sSJsSULYkml3xhJp8HRV9qdBml9NW14=
github.com/projecteru2/libyavirt v0.0.0-20200803015801-c31d39b6e15c/go.mod h1:9/SNmdphwl12ubwihkRa9YtOozM6liYLDxsricra1mY=
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
github.com/prometheus/client_golang v1.0.0 h1:vrDKnkGzuGvhNAL56c7DBz29ZL+KxnoR0x7enabFceM=
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
Expand Down