Skip to content

Conversation

@cfergeau
Copy link
Collaborator

This refactors the existing code to allow multiple storage devices to be add to the VM.
Then this adds support for USB mass storage devices (to be used for example with ISO files), and for deviceId which is useful to tag the disk images to easily identify them in the VM.

In macOS 13, there are now 2 different storage devices, VirtioBlk and
USBMassStorage. This commit introduces a base StorageConfig to allow
code sharing between the 2 implementations.
The AddToVirtualMachineConfig() API is starting to show its limitations
as we now want to add multiple storage devices to the VM.
AddToVirtualMachineConfig() creates a single
vz.StorageDeviceConfiguration object, and then passes a 1-element array
to vz.SetStorageDevicesVirtualMachineConfiguration()

This commit introduces toVz() methods which should help to address this
limitation. They make it possible to first create all the
vz.StorageDeviceConfiguration objects from different config.VirtioDevice
objects, and then pass these all at once to
to vz.SetStorageDevicesVirtualMachineConfiguration()
I'll need it to be able to first generate a list of
vz.StorageDeviceConfiguration, and then add these to
vz.VirtualMachineConfiguration.
This will allow to have multiple storage devices added to a VM.
This makes use of the toVz() API and of the VMConfig API added in the
previous commits in order to first generate a []vz.StorageDeviceConfiguration
before calling vz.SetStorageDevicesVirtualMachineConfiguration() with
this array.
This tests conversion of virtio devices to command line and then parsing
again the generated command line.
@cfergeau cfergeau merged commit 0134271 into crc-org:main Apr 4, 2023
@cfergeau cfergeau deleted the storage branch April 4, 2023 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants