Skip to content

Commit a797d31

Browse files
committed
vz: video: allow "default" as an alias for "vz"
Signed-off-by: Akihiro Suda <[email protected]>
1 parent f10a6d2 commit a797d31

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

pkg/vz/vm_darwin.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,8 @@ func attachDisks(driver *driver.BaseDriver, vmConfig *vz.VirtualMachineConfigura
487487
}
488488

489489
func attachDisplay(driver *driver.BaseDriver, vmConfig *vz.VirtualMachineConfiguration) error {
490-
if *driver.Yaml.Video.Display == "vz" {
490+
switch *driver.Yaml.Video.Display {
491+
case "vz", "default":
491492
graphicsDeviceConfiguration, err := vz.NewVirtioGraphicsDeviceConfiguration()
492493
if err != nil {
493494
return err
@@ -501,8 +502,12 @@ func attachDisplay(driver *driver.BaseDriver, vmConfig *vz.VirtualMachineConfigu
501502
vmConfig.SetGraphicsDevicesVirtualMachineConfiguration([]vz.GraphicsDeviceConfiguration{
502503
graphicsDeviceConfiguration,
503504
})
505+
return nil
506+
case "none":
507+
return nil
508+
default:
509+
return fmt.Errorf("unexpected video display %q", *driver.Yaml.Video.Display)
504510
}
505-
return nil
506511
}
507512

508513
func attachFolderMounts(driver *driver.BaseDriver, vmConfig *vz.VirtualMachineConfiguration) error {

pkg/vz/vz_driver_darwin.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,10 @@ func (l *LimaVzDriver) Validate() error {
120120
logrus.Warnf("field `audio.device` must be %q for VZ driver , got %q", "vz", audioDevice)
121121
}
122122

123-
videoDisplay := *l.Yaml.Video.Display
124-
if videoDisplay != "none" && videoDisplay != "vz" {
125-
logrus.Warnf("field `video.display` must be %q for VZ driver , got %q", "vz", videoDisplay)
123+
switch videoDisplay := *l.Yaml.Video.Display; videoDisplay {
124+
case "vz", "default", "none":
125+
default:
126+
logrus.Warnf("field `video.display` must be \"vz\", \"default\", or \"none\" for VZ driver , got %q", videoDisplay)
126127
}
127128
return nil
128129
}
@@ -146,7 +147,12 @@ func (l *LimaVzDriver) Start(ctx context.Context) (chan error, error) {
146147
}
147148

148149
func (l *LimaVzDriver) CanRunGUI() bool {
149-
return *l.Yaml.Video.Display == "vz"
150+
switch *l.Yaml.Video.Display {
151+
case "vz", "default":
152+
return true
153+
default:
154+
return false
155+
}
150156
}
151157

152158
func (l *LimaVzDriver) RunGUI() error {

0 commit comments

Comments
 (0)