Files
cozystack/hack
Mattia Eleuteri 3a5ae23797 feat(virtual-machine): group a VM's claims for Velero volume group snapshots
Velero snapshots the PVCs of an application-consistent VM backup one
after another between the guest freeze and thaw. Windows holds a VSS
freeze for 10 seconds at most, and on LINSTOR a VM with three volumes
(two disks and the persistent TPM/EFI state) outlasts it, so the thaw
fails and the backup is only crash-consistent. Velero 1.18 snapshots
the PVCs sharing a velero.io/volume-group value as one
VolumeGroupSnapshot.

Neither chart can carry that label onto the claims. CDI copies
DataVolume labels to a PVC only when it creates it, and a VMDisk
exists, PVC included, before any VM names it; KubeVirt creates the
persistent-state PVC with a fixed label set. A post-install and
post-upgrade hook of vm-instance labels them instead, and removes the
label from claims of this VM that no longer belong to the group.

Velero has no fallback for a labelled claim it cannot group: an unbound
member, a second CSI driver, or no single default
VolumeGroupSnapshotClass for the driver fails it. The group is formed
only when all of that holds and groupsnapshot v1beta2 is served, so
clusters without group snapshot support render nothing new.

The instancetype suite rendered every template, and the hook's PVC list
lookup needs a scheme it does not mock, so it is scoped to the two
templates it covers.

A vm-disk claim outlives the VM that grouped it, so a pre-delete hook
releases this VM's group on uninstall. Helm runs uninstall hooks from
the stored manifest, so that hook is rendered unconditionally and
selects the claims by this VM's label value when it runs.

Assisted-by: LLM
Signed-off-by: Mattia Eleuteri <mattia@hidora.io>
2026-11-23 11:55:31 +03:00
..