18983: Warn if LocalKeepBlobBuffersPerVCPU > 0 but will not be used.
authorTom Clegg <tom@curii.com>
Tue, 17 May 2022 05:36:06 +0000 (01:36 -0400)
committerTom Clegg <tom@curii.com>
Tue, 17 May 2022 05:36:06 +0000 (01:36 -0400)
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@curii.com>

lib/config/load.go
lib/config/load_test.go
sdk/go/health/aggregator_test.go

index 8f8ab2bf27312adb76b6597ef1f51f8e21ecb338..dba799787045d732e3a07cb65859dc7bfa096c6d 100644 (file)
@@ -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 {
index 4ae9a513c8c0d7874cfcfaaa0aeb47143ade075a..feb05cb9515bb03be84352d550c24bf82fe80320 100644 (file)
@@ -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".
index 481054c4debe449710d7b8848ff77c48cd79d550..2978d073511293c4414776bbcca83ef142745616 100644 (file)
@@ -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)