Support attaching a host block device to a guest - #871
Open
MayCXC wants to merge 1 commit into
Open
Conversation
Virtualization offers three storage attachments and the mount path reached two of them, so a block device of the host's had no way through to a guest. One now goes as the device it is, from an extension alongside the disk image and network block device ones, picked by asking the source what it is rather than by a naming convention the caller has to keep. This lets whatever backs the device on the host back it in the guest, which a disk image has no way to say: a partition, a whole disk, or a device the host holds in memory, whose pages it compresses and pages out under contention as it would any others. Integration coverage attaches an ext4 image as a block device, writes to it from the guest, and reads what landed back out of the image once the host has it again. The read only case confirms the write is refused, and a memory backed device carries a raw write with no filesystem in the way.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Virtualization offers three storage attachments and the mount path reached two of them, so a block device of the host's had no way through to a guest. One now goes as the device it is, from an extension alongside the disk image and network block device ones, picked by asking the source what it is rather than by a naming convention the caller has to keep.
This lets whatever backs the device on the host back it in the guest, which a disk image has no way to say: a partition, a whole disk, or a device the host holds in memory.
Motivation and Context
The gap was in the mount path rather than in the framework:
VZDiskBlockDeviceStorageDeviceAttachmentexists, and the two neighbouring attachment kinds were already reachable, so a caller with a block device had to convert it to an image first, which loses exactly the property that made it a block device.Deciding by asking the source what it is, rather than by a prefix or suffix on the path, means the caller does not carry a convention and a device that is not a device cannot be mistaken for one.
No issue filed, as this adds a third case to an existing enumeration rather than changing behaviour for anything that works today. Happy to open one if the project prefers it discussed first.
Testing
swift buildandmake checkclean.swift test: 595 tests in 82 suites passed, on currentmain.PodVolumeTestsattaches a host block device to a pod volume and reads it back from inside the guest.Type of Change