From 718b6b4d3db6e4b3a0a06e00d4053b915a2a9530 Mon Sep 17 00:00:00 2001 From: Derek Su Date: Tue, 24 Dec 2024 00:03:19 +0800 Subject: [PATCH] fix(monitor): remove the close of monitors No need to close the monitors after deleting a node resource. If a node is gone, monitor will return error and won't continue the following tasks. Longhorn 10035 Signed-off-by: Derek Su --- controller/monitor/disk_monitor.go | 1 - controller/node_controller.go | 16 ---------------- 2 files changed, 17 deletions(-) diff --git a/controller/monitor/disk_monitor.go b/controller/monitor/disk_monitor.go index aed2946407..c6511f016d 100644 --- a/controller/monitor/disk_monitor.go +++ b/controller/monitor/disk_monitor.go @@ -136,7 +136,6 @@ func (m *DiskMonitor) GetCollectedData() (interface{}, error) { func (m *DiskMonitor) run(value interface{}) error { node, err := m.ds.GetNode(m.nodeName) if err != nil { - logrus.WithError(err).Errorf("Failed to get longhorn node %v", m.nodeName) return errors.Wrapf(err, "failed to get longhorn node %v", m.nodeName) } diff --git a/controller/node_controller.go b/controller/node_controller.go index 047ff17728..61e2ab91e8 100644 --- a/controller/node_controller.go +++ b/controller/node_controller.go @@ -375,22 +375,6 @@ func (nc *NodeController) syncNode(key string) (err error) { if node.DeletionTimestamp != nil { nc.eventRecorder.Eventf(node, corev1.EventTypeWarning, constant.EventReasonDelete, "Deleting node %v", node.Name) - - if nc.diskMonitor != nil { - nc.diskMonitor.Stop() - nc.diskMonitor = nil - } - - if nc.environmentCheckMonitor != nil { - nc.environmentCheckMonitor.Stop() - nc.environmentCheckMonitor = nil - } - - if nc.snapshotMonitor != nil { - nc.snapshotMonitor.Stop() - nc.snapshotMonitor = nil - } - return nc.ds.RemoveFinalizerForNode(node) }