From 364d09d3631ea217ae4555d072f6c3325bc7dce5 Mon Sep 17 00:00:00 2001 From: Tim Gross Date: Thu, 3 Feb 2022 15:03:39 -0500 Subject: [PATCH] core: log CSI GC cutoff index only on non-forced GC (#11997) Non-CSI garbage collection tasks on the server only log the cutoff index in the case where it's not a forced GC from `nomad system gc`. Do the same for CSI for consistency. --- nomad/core_sched.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/nomad/core_sched.go b/nomad/core_sched.go index f6aa3c112..17925ecc7 100644 --- a/nomad/core_sched.go +++ b/nomad/core_sched.go @@ -767,12 +767,11 @@ func (c *CoreScheduler) csiVolumeClaimGC(eval *structs.Evaluation) error { tt := c.srv.fsm.TimeTable() cutoff := time.Now().UTC().Add(-1 * c.srv.config.CSIVolumeClaimGCThreshold) oldThreshold = tt.NearestIndex(cutoff) + c.logger.Debug("CSI volume claim GC scanning before cutoff index", + "index", oldThreshold, + "csi_volume_claim_gc_threshold", c.srv.config.CSIVolumeClaimGCThreshold) } - c.logger.Debug("CSI volume claim GC scanning before cutoff index", - "index", oldThreshold, - "csi_volume_claim_gc_threshold", c.srv.config.CSIVolumeClaimGCThreshold) - for i := iter.Next(); i != nil; i = iter.Next() { vol := i.(*structs.CSIVolume) @@ -821,11 +820,10 @@ func (c *CoreScheduler) csiPluginGC(eval *structs.Evaluation) error { tt := c.srv.fsm.TimeTable() cutoff := time.Now().UTC().Add(-1 * c.srv.config.CSIPluginGCThreshold) oldThreshold = tt.NearestIndex(cutoff) + c.logger.Debug("CSI plugin GC scanning before cutoff index", + "index", oldThreshold, "csi_plugin_gc_threshold", c.srv.config.CSIPluginGCThreshold) } - c.logger.Debug("CSI plugin GC scanning before cutoff index", - "index", oldThreshold, "csi_plugin_gc_threshold", c.srv.config.CSIPluginGCThreshold) - for i := iter.Next(); i != nil; i = iter.Next() { plugin := i.(*structs.CSIPlugin)