Skip to content

Commit

Permalink
Fix capitalized Vnc field and increment Vnc on run (#139)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
SammyOina authored Jun 6, 2024
1 parent ff64c10 commit 4c4161c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions manager/qemu/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions manager/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4c4161c

Please sign in to comment.