In the config loader, we require the cluster id to be specified in
[arvados.git] / lib / config / load.go
index 8f8ab2bf27312adb76b6597ef1f51f8e21ecb338..a547d1406940960ac9fd88564e0e7c6ee3ce63be 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
@@ -361,7 +362,7 @@ func (ldr *Loader) checkClusterID(label, clusterID string, emptyStringOk bool) e
        if emptyStringOk && clusterID == "" {
                return nil
        } else if !acceptableClusterIDRe.MatchString(clusterID) {
-               return fmt.Errorf("%s: cluster ID should be 5 alphanumeric characters", label)
+               return fmt.Errorf("%s: cluster ID should be 5 lowercase alphanumeric characters", label)
        }
        return nil
 }
@@ -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 {