From 4c4161ccfbf2178380d659341bea3983d972442e Mon Sep 17 00:00:00 2001 From: Sammy Kerata Oina <44265300+SammyOina@users.noreply.github.com> Date: Thu, 6 Jun 2024 17:34:13 +0300 Subject: [PATCH] Fix capitalized Vnc field and increment Vnc on run (#139) Corrected the struct field 'vnc' to 'Vnc' to match Go's public field naming conventions and to make it exportable. Each QEMU virtual machine's VNC display number now increments upon instantiation to avoid display conflicts. Signed-off-by: SammyOina --- manager/qemu/config.go | 4 ++-- manager/service.go | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/manager/qemu/config.go b/manager/qemu/config.go index 6318b2b4..4803525b 100644 --- a/manager/qemu/config.go +++ b/manager/qemu/config.go @@ -55,7 +55,7 @@ type SevConfig struct { type VSockConfig struct { ID string `env:"VSOCK_ID" envDefault:"vhost-vsock-pci0"` GuestCID int `env:"VSOCK_GUEST_CID" envDefault:"3"` - vnc int `env:"VSOCK_VNC" envDefault:"0"` + Vnc int `env:"VSOCK_VNC" envDefault:"0"` } type Config struct { @@ -157,7 +157,7 @@ func constructQemuArgs(config Config) []string { config.VirtioNetPciConfig.ROMFile)) args = append(args, "-device", fmt.Sprintf("vhost-vsock-pci,id=%s,guest-cid=%d", config.VSockConfig.ID, config.VSockConfig.GuestCID)) - args = append(args, "-vnc", fmt.Sprintf(":%d", config.vnc)) + args = append(args, "-vnc", fmt.Sprintf(":%d", config.Vnc)) if config.EnableSEVSNP { args = append(args, "-object", diff --git a/manager/service.go b/manager/service.go index 368a16b5..f47cb496 100644 --- a/manager/service.go +++ b/manager/service.go @@ -119,6 +119,7 @@ func (ms *managerService) Run(ctx context.Context, c *manager.ComputationRunReq) return "", err } ms.qemuCfg.VSockConfig.GuestCID++ + ms.qemuCfg.VSockConfig.Vnc++ ms.publishEvent("vm-provision", c.Id, "complete", json.RawMessage{}) return fmt.Sprint(ms.qemuCfg.HostFwdAgent), nil