fix(vi): attach PVC-backed images to VMs in read-only mode#2620
Open
eofff wants to merge 2 commits into
Open
Conversation
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.
Description
VirtualImagewithstorage: PersistentVolumeClaim/Kuberneteswas attached to a VM as a regular writable PVC volume, while registry-backed images (storage: ContainerRegistry) are always read-only (ContainerDisk).Now a PVC-backed image is attached read-only in both paths:
.spec.blockDeviceRefs): the controller setsreadonly: trueon the disk target andreadOnly: trueon the PVC volume source (kvbuilder).addvolumesubresource):virtualization-apisets the same flags when mutating the hotplug request. ISO images are not affected: CD-ROM is read-only by default.Why do we need it, and what problem does it solve?
Images are immutable by design, and the documentation states that images are connected in read-only mode. However, a guest OS could write to a PVC-backed image, corrupting it for all VMs using this image.
What is the expected result?
VirtualImagewithstorage: PersistentVolumeClaim..spec.blockDeviceRefsorVirtualMachineBlockDeviceAttachment.lsblkshowsRO=1), writes fail with a write-protect error.Note: for already attached images the change is applied after VM restart (static attach) or VMBDA re-attach (hotplug). VMs with
enableParavirtualization: falsecannot use read-only non-ISO disks on the SATA bus (KubeVirt restriction).Checklist
Changelog entries