From 8126e0f6db75ddc9775e12f3f175befb6e0ddcec Mon Sep 17 00:00:00 2001 From: Elena Gershkovich Date: Mon, 17 Jun 2024 16:48:05 +0300 Subject: [PATCH] Improve log during restore PVs and PVS for VolRep to reflect the core error Signed-off-by: Elena Gershkovich --- controllers/vrg_volrep.go | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/controllers/vrg_volrep.go b/controllers/vrg_volrep.go index 1c600da197..dd41e303cb 100644 --- a/controllers/vrg_volrep.go +++ b/controllers/vrg_volrep.go @@ -1847,6 +1847,7 @@ func (v *VRGInstance) restorePVsAndPVCsForVolRep(result *ctrl.Result) (int, erro return count, nil } +//nolint:funlen func (v *VRGInstance) restorePVsAndPVCsFromS3(result *ctrl.Result) (int, error) { err := errors.New("s3Profiles empty") NoS3 := false @@ -1877,6 +1878,8 @@ func (v *VRGInstance) restorePVsAndPVCsFromS3(result *ctrl.Result) (int, error) // Restore all PVs found in the s3 store. If any failure, the next profile will be retried pvCount, err = v.restorePVsFromObjectStore(objectStore, s3ProfileName) if err != nil { + v.log.Info(fmt.Sprintf("Warning: cannot restore PVs from s3 profile %s (%v)", s3ProfileName, err)) + continue } @@ -1889,7 +1892,13 @@ func (v *VRGInstance) restorePVsAndPVCsFromS3(result *ctrl.Result) (int, error) // Ignoring PVC restore errors helps with the upgrade from ODF-4.12.x to 4.13 pvcCount, err = v.restorePVCsFromObjectStore(objectStore, s3ProfileName) - if err != nil || pvCount != pvcCount { + if err != nil { + v.log.Info(fmt.Sprintf("Warning: cannot restore PVCs from s3 profile %s (%v)", s3ProfileName, err)) + + continue + } + + if pvCount != pvcCount { v.log.Info(fmt.Sprintf("Warning: Mismatch in PV/PVC count %d/%d (%v)", pvCount, pvcCount, err)) @@ -1913,19 +1922,13 @@ func (v *VRGInstance) restorePVsAndPVCsFromS3(result *ctrl.Result) (int, error) func (v *VRGInstance) restorePVsFromObjectStore(objectStore ObjectStorer, s3ProfileName string) (int, error) { pvList, err := downloadPVs(objectStore, v.s3KeyPrefix()) if err != nil { - v.log.Error(err, fmt.Sprintf("error fetching PV cluster data from S3 profile %s", s3ProfileName)) - return 0, err } v.log.Info(fmt.Sprintf("Found %d PVs in s3 store using profile %s", len(pvList), s3ProfileName)) if err = v.checkPVClusterData(pvList); err != nil { - errMsg := fmt.Sprintf("Error found in PV cluster data in S3 store %s", s3ProfileName) - v.log.Info(errMsg) - v.log.Error(err, fmt.Sprintf("Resolve PV conflict in the S3 store %s to deploy the application", s3ProfileName)) - - return 0, fmt.Errorf("%s: %w", errMsg, err) + return 0, err } return restoreClusterDataObjects(v, pvList, "PV", cleanupPVForRestore, v.validateExistingPV) @@ -1934,8 +1937,6 @@ func (v *VRGInstance) restorePVsFromObjectStore(objectStore ObjectStorer, s3Prof func (v *VRGInstance) restorePVCsFromObjectStore(objectStore ObjectStorer, s3ProfileName string) (int, error) { pvcList, err := downloadPVCs(objectStore, v.s3KeyPrefix()) if err != nil { - v.log.Error(err, fmt.Sprintf("error fetching PVC cluster data from S3 profile %s", s3ProfileName)) - return 0, err }