Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implementation for #30 :
The virtualization framework supports having multiple automounted volumes with different readonly vs readwrite statuses, as can be seen described in Apple's documentation for VZVirtioFileSystemDeviceConfiguration
But the current support for
--vol
only allows for one automounted volume. If two are specified, an error is thrown due to reusing the same VZVirtioFileSystemDeviceConfiguration.macOSGuestAutomountTag tag.There is a method already in macosvm called
addAutomountDirectoryShares:readOnly:
which does know how to share describe multiple automounted directories, but it forces them all to have the same value for readOnly, and the code is currently unreachable.Motivating example:
I want to start my VM with two automounted directories, one that is readonly so that the guest VM can't ruin it, and one that has readwrite capabilities so that the guest VM can write some data back to the host.
Implementation:
I've hacked this together by making macosvm loop over the shares twice:
VZVirtioFileSystemDeviceConfiguration.macOSGuestAutomountTag
tag.Additionally, while editing this months ago, I had found myself getting lost multiple times when trying to follow the code's conditions and ifdefs because several blocks of the code were indented inconsistently across those boundaries and would look like they were different code blocks in my IDE. So I spent some time re-indenting the blocks that were giving me trouble.
I can undo that if you prefer.