From 8b7cb2880dabc9b6f1566681285987d6a448f6e9 Mon Sep 17 00:00:00 2001 From: Tim Gross Date: Wed, 21 Oct 2020 16:54:28 -0400 Subject: [PATCH] csi: prevent in-use plugin GC from blocking volume GC (#9141) During CSI plugin GC, we don't return an error if the volume is in use, because this is not an error condition. If we were to return an error during a `nomad system gc`, we would not continue on to GC volumes. But check for the specific error message fails if the GC is performed on a worker rather than on the leader, due to RPC forwarding wrapping the error message. Use a less specific test so that we don't return an error. --- nomad/core_sched.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nomad/core_sched.go b/nomad/core_sched.go index 85659118ae1c..1ac135d0aaea 100644 --- a/nomad/core_sched.go +++ b/nomad/core_sched.go @@ -860,7 +860,7 @@ func (c *CoreScheduler) csiPluginGC(eval *structs.Evaluation) error { }} err := c.srv.RPC("CSIPlugin.Delete", req, &structs.CSIPluginDeleteResponse{}) if err != nil { - if err.Error() == "plugin in use" { + if strings.Contains(err.Error(), "plugin in use") { continue } c.logger.Error("failed to GC plugin", "plugin_id", plugin.ID, "error", err)