file: allow filesystem removal even with failures
If the filesystem is in a bad state such as never being created successfully in the first place, the filesystem removal will continuously fail and prevent the CR from being removed. Thus, we treat the filesystem removal as a best effort and log the issue instead of failing the uninstall reconcile. Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
This commit is contained in:
1 file changed
+4
-2
@@ -104,13 +104,15 @@ func deleteFilesystem(
|
||||
// The K8s resources will already be removed with the K8s owner references
|
||||
if err := downFilesystem(context, clusterInfo, fs.Name); err != nil {
|
||||
// If the fs isn't deleted from Ceph, leave the daemons so it can still be used.
|
||||
return errors.Wrapf(err, "failed to down filesystem %q", fs.Name)
|
||||
// Log the error for best effort and continue
|
||||
logger.Warningf("continuing to remove filesystem CR even though downing the filesystem failed. %v", err)
|
||||
}
|
||||
|
||||
// Permanently remove the filesystem if it was created by rook and the spec does not prevent it.
|
||||
if len(fs.Spec.DataPools) != 0 && !fs.Spec.PreserveFilesystemOnDelete {
|
||||
if err := cephclient.RemoveFilesystem(context, clusterInfo, fs.Name, fs.Spec.PreservePoolsOnDelete); err != nil {
|
||||
return errors.Wrapf(err, "failed to remove filesystem %q", fs.Name)
|
||||
// log the error for best effort and continue
|
||||
logger.Warningf("continuing to remove filesystem CR even though removal failed. %v", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
||||
Reference in new issue
Block a user