fix(disks): restore disk from snapshot when storage rounds size up#2635
Draft
nevermarine wants to merge 1 commit into
Draft
fix(disks): restore disk from snapshot when storage rounds size up#2635nevermarine wants to merge 1 commit into
nevermarine wants to merge 1 commit into
Conversation
When a VirtualDisk is created without an explicit size, its PVC is requested at the data source's virtual size. Storage backends that round volume sizes up (e.g. Ceph RBD rounds to whole GiB) provision a larger volume, so the VolumeSnapshot restore size exceeds the originally requested size stored in the snapshot metadata. On restore that stored original size was validated against the snapshot restore size and rejected as insufficient, leaving the restored disk Failed and the VirtualMachineOperation restore stuck in Failed. Use the restore size as a lower bound when the size comes from the snapshot metadata rather than an explicit user request. Signed-off-by: Maksim Fedotov <maksim.fedotov@flant.com>
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
Restoring a virtual disk (and therefore a virtual machine) from a snapshot fails on storage backends that round volume sizes up to a fixed granularity — for example Ceph RBD rounds up to whole GiB. The restored disk stays in the
Failedphase with aProvisioningFailed/ "the specified pvc size is insufficient" error, and anyVirtualMachineOperationrestore that depends on it never reachesCompleted.It happens when the source disk was created without an explicit size: its volume is requested at the source image's virtual size, but the backend provisions a larger volume, so the snapshot's restore size ends up bigger than the size recorded in the snapshot metadata. On restore that smaller recorded size was rejected as insufficient. It is now treated as a lower bound and raised to the snapshot restore size, but only when the size was not explicitly set by the user (an explicit too-small user request is still rejected).
Why do we need it, and what problem does it solve?
On rounding storage backends (Ceph RBD is the common case) snapshot restore is effectively broken for any disk that was provisioned without an explicit size — the restored disk and the restore operation are stuck in
Failed. This restores the ability to recover disks and VMs from snapshots on such storage.What is the expected result?
Reproduction (on a Ceph RBD storage class):
VirtualDiskfrom aClusterVirtualImagewithspec.persistentVolumeClaim: {}(no size). The PVC is requested at the image virtual size but provisioned rounded up to the next GiB.VirtualDiskSnapshotof it.VirtualDiskfrom that snapshot with no explicit size.Before: the new disk goes to
Failed(the specified pvc size is insufficient).After: the new disk provisions at the snapshot restore size and becomes
Ready; VMOP restore completes.Checklist
Changelog entries