Add accessor for VZVirtualMachineConfiguration:socketDevices
cfergeau opened this issue · comments
Is your feature request related to a problem? Please describe.
It's not allowed to add more than one virtio-vsock device to a virtual machine.
https://developer.apple.com/documentation/virtualization/vzvirtualmachineconfiguration/3656726-socketdevices?language=objc says:
create a single VZVirtioSocketDeviceConfiguration object, add it to an array, and assign it to this property.
It would be useful to have an accessor for this property. This accessor would make it possible to check if the VZVirtualMachineConfiguration being created has already been assigned a virtio-vsock device or not.
Describe the solution you'd like
A func (v *VirtualMachineConfiguration) SocketDevices() []SocketDeviceConfiguration
go method would be useful to have. It's then possible to check its length to know if it's necessary to create a new VirtioSocketDeviceConfiguration, or if the device is already present.
I've implemented this in cfergeau@3a33c57
It's based on the code for VirtualMachine:SocketDevices
I can file a PR for it.
@cfergeau SGTM
If you send PR, please rename VZVirtualMachineConfiguration_socketDevices
to socketDevicesVZVirtualMachineConfiguration
🙏
I think we want also networkDevices
one maybe.
I will rename it. I used this naming to match VZVirtualMachine_socketDevices
Could be useful to have a getter for https://developer.apple.com/documentation/virtualization/vzvirtualmachineconfiguration/3656727-storagedevices?language=objc too