From 2261105749bcb52e0b9d5dfc19c40fed9e8ab0c4 Mon Sep 17 00:00:00 2001 From: boedy Date: Mon, 30 Oct 2023 18:29:17 +0100 Subject: [PATCH] BugFixes: - findMatchingEvacuatedResource should only consider Diskfull resources - Nil pointer check: can be nil when node is offline --- internal/controller/linstorsatellite_controller.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/controller/linstorsatellite_controller.go b/internal/controller/linstorsatellite_controller.go index bf91c68f..74371b19 100644 --- a/internal/controller/linstorsatellite_controller.go +++ b/internal/controller/linstorsatellite_controller.go @@ -446,6 +446,9 @@ func (r *LinstorSatelliteReconciler) evacuateNode(ctx context.Context, lc *linst findMatchingEvacuatedResource := func(nodeRes lclient.ResourceWithVolumes) *lclient.ResourceWithVolumes { for _, evacuatedRes := range evacuatedResources { + if utils.IsDisklessResource(evacuatedRes) { + continue + } if nodeRes.Name == evacuatedRes.Name && evacuatedRes.Props[NodeEvacuationProp] == node.Name { return &evacuatedRes } @@ -527,6 +530,9 @@ func (r *LinstorSatelliteReconciler) undoNodeEvacuation(ctx context.Context, lc }) for _, resource := range res { + if resource.State == nil || resource.State.InUse == nil { + continue + } // If an evacuated resource is in use, it means we can delete the original resource. // We also update the resource properties to remove the NodeEvacuationProp // as we've just deleted the original resource it was pointing to.