From 023acf4a0b756b55eebe64d0c8ae96c47f9aa654 Mon Sep 17 00:00:00 2001 From: riya-singhal31 Date: Thu, 29 Sep 2022 12:30:01 +0530 Subject: [PATCH] fix: deletion of lvmcluster which includes wrong paths Deleting the lvmvolumegroup CR does not clean the VG entry in the lvmvolumegroupnodestatus if lvmdconfig file does not exists and returns immediately. Fix the same via updating the lvmvolumegroupnodestatus. Signed-off-by: riya-singhal31 --- pkg/vgmanager/vgmanager_controller.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/vgmanager/vgmanager_controller.go b/pkg/vgmanager/vgmanager_controller.go index 8bd988ebd..7de286342 100644 --- a/pkg/vgmanager/vgmanager_controller.go +++ b/pkg/vgmanager/vgmanager_controller.go @@ -324,6 +324,12 @@ func (r *VGReconciler) processDelete(ctx context.Context, volumeGroup *lvmv1alph } if lvmdConfig == nil { r.Log.Info("lvmd config file does not exist") + // Remove the VG entry in the lvmvolumegroupnodestatus that was added to indicate the failures to the user. + // This allows the lvmcluster to get deleted and not stuck/wait forever as lvmcluster looks for the lvmvolumegroupnodestatus before deleting. + if statuserr := r.updateStatus(ctx, nil); statuserr != nil { + r.Log.Error(statuserr, "failed to update status", "VGName", volumeGroup.Name) + return statuserr + } return nil } // To avoid having to iterate through device classes multiple times, map from name to config index