From: Tom Clegg Date: Tue, 17 May 2022 05:36:06 +0000 (-0400) Subject: 18983: Warn if LocalKeepBlobBuffersPerVCPU > 0 but will not be used. X-Git-Tag: 2.5.0~160^2 X-Git-Url: https://git.arvados.org/arvados.git/commitdiff_plain/dcf8de623d744458d7e39a1efe3814349de76649 18983: Warn if LocalKeepBlobBuffersPerVCPU > 0 but will not be used. Arvados-DCO-1.1-Signed-off-by: Tom Clegg --- diff --git a/lib/config/load.go b/lib/config/load.go index 8f8ab2bf27..dba7997870 100644 --- a/lib/config/load.go +++ b/lib/config/load.go @@ -340,6 +340,7 @@ func (ldr *Loader) Load() (*arvados.Config, error) { ldr.checkEnum("Containers.LocalKeepLogsToContainerLog", cc.Containers.LocalKeepLogsToContainerLog, "none", "all", "errors"), ldr.checkEmptyKeepstores(cc), ldr.checkUnlistedKeepstores(cc), + ldr.checkLocalKeepBlobBuffers(cc), ldr.checkStorageClasses(cc), ldr.checkCUDAVersions(cc), // TODO: check non-empty Rendezvous on @@ -437,6 +438,24 @@ cluster: return nil } +func (ldr *Loader) checkLocalKeepBlobBuffers(cc arvados.Cluster) error { + kbb := cc.Containers.LocalKeepBlobBuffersPerVCPU + if kbb == 0 { + return nil + } + for uuid, vol := range cc.Volumes { + if len(vol.AccessViaHosts) > 0 { + ldr.Logger.Warnf("LocalKeepBlobBuffersPerVCPU is %d but will not be used because at least one volume (%s) uses AccessViaHosts -- suggest changing to 0", kbb, uuid) + return nil + } + if !vol.ReadOnly && vol.Replication < cc.Collections.DefaultReplication { + ldr.Logger.Warnf("LocalKeepBlobBuffersPerVCPU is %d but will not be used because at least one volume (%s) has lower replication than DefaultReplication (%d < %d) -- suggest changing to 0", kbb, uuid, vol.Replication, cc.Collections.DefaultReplication) + return nil + } + } + return nil +} + func (ldr *Loader) checkStorageClasses(cc arvados.Cluster) error { classOnVolume := map[string]bool{} for volid, vol := range cc.Volumes { diff --git a/lib/config/load_test.go b/lib/config/load_test.go index 4ae9a513c8..feb05cb951 100644 --- a/lib/config/load_test.go +++ b/lib/config/load_test.go @@ -237,7 +237,7 @@ Clusters: InternalURLs: "http://host.example:12345": {} Volumes: - zzzzz-nyw5e-aaaaaaaaaaaaaaa: {} + zzzzz-nyw5e-aaaaaaaaaaaaaaa: {Replication: 2} `, &logbuf).Load() c.Assert(err, check.IsNil) c.Log(logbuf.String()) @@ -601,6 +601,31 @@ func (s *LoadSuite) TestListKeys(c *check.C) { } } +func (s *LoadSuite) TestWarnUnusedLocalKeep(c *check.C) { + var logbuf bytes.Buffer + _, err := testLoader(c, ` +Clusters: + z1111: + Volumes: + z: + Replication: 1 +`, &logbuf).Load() + c.Assert(err, check.IsNil) + c.Check(logbuf.String(), check.Matches, `(?ms).*LocalKeepBlobBuffersPerVCPU is 1 but will not be used because at least one volume \(z\) has lower replication than DefaultReplication \(1 < 2\) -- suggest changing to 0.*`) + + logbuf.Reset() + _, err = testLoader(c, ` +Clusters: + z1111: + Volumes: + z: + AccessViaHosts: + "http://0.0.0.0:12345": {} +`, &logbuf).Load() + c.Assert(err, check.IsNil) + c.Check(logbuf.String(), check.Matches, `(?ms).*LocalKeepBlobBuffersPerVCPU is 1 but will not be used because at least one volume \(z\) uses AccessViaHosts -- suggest changing to 0.*`) +} + func (s *LoadSuite) TestImplicitStorageClasses(c *check.C) { // If StorageClasses and Volumes.*.StorageClasses are all // empty, there is a default storage class named "default". diff --git a/sdk/go/health/aggregator_test.go b/sdk/go/health/aggregator_test.go index 481054c4de..2978d07351 100644 --- a/sdk/go/health/aggregator_test.go +++ b/sdk/go/health/aggregator_test.go @@ -48,6 +48,7 @@ func (s *AggregatorSuite) SetUpTest(c *check.C) { cluster.SystemRootToken = arvadostest.SystemRootToken cluster.Collections.BlobSigningKey = arvadostest.BlobSigningKey cluster.Volumes["z"] = arvados.Volume{StorageClasses: map[string]bool{"default": true}} + cluster.Containers.LocalKeepBlobBuffersPerVCPU = 0 s.handler = &Aggregator{Cluster: cluster} s.req = httptest.NewRequest("GET", "/_health/all", nil) s.req.Header.Set("Authorization", "Bearer "+arvadostest.ManagementToken)