Identify the backed-up volume by CSI volume handle in the in-place restore pre-flight check (#10530)

The pre-flight check that verifies the existing PVC is still bound to the
backed-up volume compared PV names. A block data mover restore of a file
system volume recreates the PV under a new name (the volumeMode field is
immutable), so a second in-place restore of the same workload failed the
check even though the PVC was bound to the very same volume.

Record the CSI volume handle in the backup volume info (PVInfo) and
compare handles when both the backup and the bound PV record one; the
PV name remains the fallback for non-CSI volumes and for backups taken
before the handle was recorded. The handle reaches the PVC CSI RIA
through the same carrier annotation mechanism as the source size.

Signed-off-by: chlins <chlins.zhang@gmail.com>
This commit is contained in:
Chlins Zhang
2026-09-16 16:55:27 -04:00
committed by GitHub
parent 473f7529e1
commit e164dc5984
12 changed files with 302 additions and 62 deletions
+8
View File
@@ -192,6 +192,14 @@ const (
// run the in-place restore capacity pre-flight check without access to the volume info.
// The annotation is always stripped by the restore engine; it never lands on the cluster.
InplaceRestoreSourceSizeAnnotation = "restore.velero.io/inplace-restore-source-size"
// InplaceRestoreVolumeHandleAnnotation is a Velero-internal carrier annotation set by the
// restore engine on a PVC item before RestoreItemActions run. It carries the CSI volume
// handle of the PV the PVC was bound to at backup time, recorded in the backup volume info,
// so the PVC CSI RestoreItemAction can verify the existing PVC is still bound to the
// backed-up volume. The annotation is always stripped by the restore engine; it never lands
// on the cluster.
InplaceRestoreVolumeHandleAnnotation = "restore.velero.io/inplace-restore-volume-handle"
// SkippedNoCSIPVAnnotation - Velero checks this annotation on processed PVC to
// find out if the snapshot was skipped b/c the PV is not provisioned via CSI
SkippedNoCSIPVAnnotation = "backup.velero.io/skipped-no-csi-pv"