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 <sammyoina@gmail.com>
This commit is contained in:
Sammy Kerata Oina
2024-06-06 17:34:13 +03:00
committed by GitHub
parent ff64c10ac3
commit 4c4161ccfb
2 changed files with 3 additions and 2 deletions
+2 -2
View File
@@ -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",
+1
View File
@@ -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