Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PB-7158, PB-7159: Fix Handling of Cloud Based CSI Backups - NFS Location #387

Merged
merged 1 commit into from
Jul 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions pkg/executor/nfs/nfsrestoreresources.go
Original file line number Diff line number Diff line change
Expand Up @@ -383,14 +383,20 @@ func getPVCToPVMapping(allObjects []runtime.Unstructured) (map[string]*v1.Persis
return pvcNameToPV, nil
}

func isGenericCSIPersistentVolume(pv *v1.PersistentVolume) (bool, error) {
func isGenericCSIPersistentVolume(pv *v1.PersistentVolume, volInfos []*storkapi.ApplicationRestoreVolumeInfo) (bool, error) {
driverName, err := volume.GetPVDriverForRestore(pv)
if err != nil {
return false, err
}
if driverName == "csi" {
return true, nil
}
// in case of cloud disk such as GCE, AWS, Azure, we need to skip the volumes as its now moved to csi
for _, vInfo := range volInfos {
if vInfo.RestoreVolume == pv.Name && vInfo.DriverName == "csi" {
return true, nil
}
}
return false, nil
}
func isGenericPersistentVolume(pv *v1.PersistentVolume, volInfos []*storkapi.ApplicationRestoreVolumeInfo) (bool, error) {
Expand Down Expand Up @@ -436,7 +442,7 @@ func removeCSIVolumesBeforeApply(
}

// Check if this PV is a generic CSI one
isGenericCSIPVC, err := isGenericCSIPersistentVolume(&pv)
isGenericCSIPVC, err := isGenericCSIPersistentVolume(&pv, restore.Status.Volumes)
if err != nil {
return nil, fmt.Errorf("failed to check if PV was provisioned by a CSI driver: %v", err)
}
Expand Down Expand Up @@ -468,7 +474,7 @@ func removeCSIVolumesBeforeApply(

// We have found a PV for this PVC. Check if it is a generic CSI PV
// that we do not already have native volume driver support for.
isGenericCSIPVC, err := isGenericCSIPersistentVolume(pv)
isGenericCSIPVC, err := isGenericCSIPersistentVolume(pv, restore.Status.Volumes)
if err != nil {
return nil, err
}
Expand Down
Loading