mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-09-18 22:14:29 +00:00
Skip VGS cleanup when backup did not use VolumeGroupSnapshots
Guard the cleanupStubVGSC() call in restore finalization with a check for VolumeGroupSnapshotHandle in volumeInfo. This avoids a spurious warning on clusters where the v1beta2 VolumeGroupSnapshotContent CRD is not installed, since the List call would fail even though no stubs exist to clean up. Fixes #9882 Signed-off-by: Shubham Pampattiwar <spampatt@redhat.com>
This commit is contained in:
@@ -301,8 +301,10 @@ func (ctx *finalizerContext) execute() (results.Result, results.Result) {
|
||||
pdpErrs := ctx.patchDynamicPVWithVolumeInfo()
|
||||
errs.Merge(&pdpErrs)
|
||||
|
||||
vgscWarnings := ctx.cleanupStubVGSC()
|
||||
warnings.Merge(&vgscWarnings)
|
||||
if ctx.hasVolumeGroupSnapshotHandles() {
|
||||
vgscWarnings := ctx.cleanupStubVGSC()
|
||||
warnings.Merge(&vgscWarnings)
|
||||
}
|
||||
|
||||
rehErrs := ctx.WaitRestoreExecHook()
|
||||
errs.Merge(&rehErrs)
|
||||
@@ -449,6 +451,15 @@ func (ctx *finalizerContext) patchDynamicPVWithVolumeInfo() (errs results.Result
|
||||
return errs
|
||||
}
|
||||
|
||||
func (ctx *finalizerContext) hasVolumeGroupSnapshotHandles() bool {
|
||||
for _, vi := range ctx.volumeInfo {
|
||||
if vi.CSISnapshotInfo != nil && vi.CSISnapshotInfo.VolumeGroupSnapshotHandle != "" {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// cleanupStubVGSC deletes stub VolumeGroupSnapshotContent objects that were
|
||||
// created during restore to satisfy CSI controller validation. These stubs are
|
||||
// labeled with velero.io/restore-name for identification.
|
||||
|
||||
Reference in New Issue
Block a user