From 559a440a347ffd1bf9dc09d734381d7937cd287c Mon Sep 17 00:00:00 2001 From: Etienne Perot Date: Thu, 19 Jan 2023 18:19:47 -0800 Subject: vm/gvisor: implement vmimpl.Infoer for runsc instances (#3622) This adds VM info for runsc (gVisor) instances, showing the flags passed to runsc. --- vm/gvisor/gvisor.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'vm/gvisor/gvisor.go') diff --git a/vm/gvisor/gvisor.go b/vm/gvisor/gvisor.go index 31e3a10d5..cf9a8b126 100644 --- a/vm/gvisor/gvisor.go +++ b/vm/gvisor/gvisor.go @@ -210,7 +210,7 @@ func (inst *instance) waitBoot() error { } } -func (inst *instance) runscCmd(add ...string) *exec.Cmd { +func (inst *instance) args() []string { args := []string{ "-root", inst.rootDir, "-watchdog-action=panic", @@ -223,8 +223,16 @@ func (inst *instance) runscCmd(add ...string) *exec.Cmd { if inst.cfg.RunscArgs != "" { args = append(args, strings.Split(inst.cfg.RunscArgs, " ")...) } - args = append(args, add...) - cmd := osutil.Command(inst.image, args...) + return args +} + +func (inst *instance) Info() ([]byte, error) { + info := fmt.Sprintf("%v %v\n", inst.image, strings.Join(inst.args(), " ")) + return []byte(info), nil +} + +func (inst *instance) runscCmd(add ...string) *exec.Cmd { + cmd := osutil.Command(inst.image, append(inst.args(), add...)...) cmd.Env = []string{ "GOTRACEBACK=all", "GORACE=halt_on_error=1", -- cgit mrf-deployment