Improved cleanupLogicalVolume
@@ -150,12 +150,8 @@ func (r *NodeReconciler) cleanupLogicalVolume(ctx context.Context, log logr.Logg
break
}
}
- if !finExists {
- return nil
- }
-
- log.Info("deleting LogicalVolume", "name", lv.Name)
+ if finExists {
lv2 := lv.DeepCopy()
var finalizers []string
for _, fin := range lv2.Finalizers {
@@ -171,14 +167,15 @@ func (r *NodeReconciler) cleanupLogicalVolume(ctx context.Context, log logr.Logg
log.Error(err, "failed to patch LogicalVolume", "name", lv.Name)
return err
}
+ }
err := r.Delete(ctx, lv)
if err != nil {
log.Error(err, "failed to delete LogicalVolume", "name", lv.Name)
return err
}
- log.Info("deleted LogicalVolume", "name", lv.Name)
+ log.Info("deleted LogicalVolume", "name", lv.Name)
return nil
}
