Skip to content

Commit af048c4

Browse files
committed
Allow using default and none in vz
Signed-off-by: Anders F Björklund <[email protected]>
1 parent a232747 commit af048c4

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

pkg/vz/vm_darwin.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,8 @@ func attachFolderMounts(driver *driver.BaseDriver, vmConfig *vz.VirtualMachineCo
574574
}
575575

576576
func attachAudio(driver *driver.BaseDriver, config *vz.VirtualMachineConfiguration) error {
577-
if *driver.Yaml.Audio.Device == "vz" {
577+
switch *driver.Yaml.Audio.Device {
578+
case "vz", "default":
578579
outputStream, err := vz.NewVirtioSoundDeviceHostOutputStreamConfiguration()
579580
if err != nil {
580581
return err
@@ -587,8 +588,12 @@ func attachAudio(driver *driver.BaseDriver, config *vz.VirtualMachineConfigurati
587588
config.SetAudioDevicesVirtualMachineConfiguration([]vz.AudioDeviceConfiguration{
588589
soundDeviceConfiguration,
589590
})
591+
return nil
592+
case "", "none":
593+
return nil
594+
default:
595+
return fmt.Errorf("unexpected audio device %q", *driver.Yaml.Audio.Device)
590596
}
591-
return nil
592597
}
593598

594599
func attachOtherDevices(_ *driver.BaseDriver, vmConfig *vz.VirtualMachineConfiguration) error {

pkg/vz/vz_driver_darwin.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,11 @@ func (l *LimaVzDriver) Validate() error {
131131
}
132132
}
133133

134-
audioDevice := *l.Yaml.Audio.Device
135-
if audioDevice != "" && audioDevice != "vz" {
136-
logrus.Warnf("field `audio.device` must be %q for VZ driver , got %q", "vz", audioDevice)
134+
switch audioDevice := *l.Yaml.Audio.Device; audioDevice {
135+
case "":
136+
case "vz", "default", "none":
137+
default:
138+
logrus.Warnf("field `audio.device` must be \"vz\", \"default\", or \"none\" for VZ driver, got %q", audioDevice)
137139
}
138140

139141
switch videoDisplay := *l.Yaml.Video.Display; videoDisplay {

0 commit comments

Comments
 (0)