X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/7aaf9f22aa646077b4b7fd961d6b731185b88137..da83807d6bcef1c1f0bb78479c5ec17f150f5eda:/services/keepstore/volume.go diff --git a/services/keepstore/volume.go b/services/keepstore/volume.go index cf0b7a3902..f597ff5781 100644 --- a/services/keepstore/volume.go +++ b/services/keepstore/volume.go @@ -2,7 +2,7 @@ // // SPDX-License-Identifier: AGPL-3.0 -package main +package keepstore import ( "context" @@ -316,8 +316,6 @@ func makeRRVolumeManager(logger logrus.FieldLogger, cluster *arvados.Cluster, my if err != nil { return nil, fmt.Errorf("error initializing volume %s: %s", uuid, err) } - logger.Printf("started volume %s (%s), ReadOnly=%v", uuid, vol, cfgvol.ReadOnly || va.ReadOnly) - sc := cfgvol.StorageClasses if len(sc) == 0 { sc = map[string]bool{"default": true} @@ -330,7 +328,8 @@ func makeRRVolumeManager(logger logrus.FieldLogger, cluster *arvados.Cluster, my KeepMount: arvados.KeepMount{ UUID: uuid, DeviceID: vol.GetDeviceID(), - ReadOnly: cfgvol.ReadOnly || va.ReadOnly, + AllowWrite: !va.ReadOnly && !cfgvol.ReadOnly, + AllowTrash: !va.ReadOnly && (!cfgvol.ReadOnly || cfgvol.AllowTrashWhenReadOnly), Replication: repl, StorageClasses: sc, }, @@ -340,9 +339,10 @@ func makeRRVolumeManager(logger logrus.FieldLogger, cluster *arvados.Cluster, my vm.mounts = append(vm.mounts, mnt) vm.mountMap[uuid] = mnt vm.readables = append(vm.readables, mnt) - if !mnt.KeepMount.ReadOnly { + if mnt.KeepMount.AllowWrite { vm.writables = append(vm.writables, mnt) } + logger.Printf("started volume %s (%s), AllowWrite=%v, AllowTrash=%v", uuid, vol, mnt.AllowWrite, mnt.AllowTrash) } // pri(mnt): return highest priority of any storage class // offered by mnt @@ -382,7 +382,7 @@ func (vm *RRVolumeManager) Mounts() []*VolumeMount { } func (vm *RRVolumeManager) Lookup(uuid string, needWrite bool) *VolumeMount { - if mnt, ok := vm.mountMap[uuid]; ok && (!needWrite || !mnt.ReadOnly) { + if mnt, ok := vm.mountMap[uuid]; ok && (!needWrite || mnt.AllowWrite) { return mnt } return nil