X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/9f4f850c2818cbf5eea45e30d27b13c20bd2be0c..2a647f35c36c8996651abaf50ad1f53e0496a8bc:/services/keep-balance/balance.go diff --git a/services/keep-balance/balance.go b/services/keep-balance/balance.go index 215c5e1b5b..e44dfeda87 100644 --- a/services/keep-balance/balance.go +++ b/services/keep-balance/balance.go @@ -227,7 +227,7 @@ func (bal *Balancer) cleanupMounts() { rwdev := map[string]*KeepService{} for _, srv := range bal.KeepServices { for _, mnt := range srv.mounts { - if !mnt.ReadOnly { + if mnt.AllowWrite { rwdev[mnt.UUID] = srv } } @@ -237,7 +237,7 @@ func (bal *Balancer) cleanupMounts() { for _, srv := range bal.KeepServices { var dedup []*KeepMount for _, mnt := range srv.mounts { - if mnt.ReadOnly && rwdev[mnt.UUID] != nil { + if !mnt.AllowWrite && rwdev[mnt.UUID] != nil { bal.logf("skipping srv %s readonly mount %q because same volume is mounted read-write on srv %s", srv, mnt.UUID, rwdev[mnt.UUID]) } else { dedup = append(dedup, mnt) @@ -587,9 +587,11 @@ func (bal *Balancer) setupLookupTables() { for _, mnt := range srv.mounts { bal.mounts++ - // All mounts on a read-only service are - // effectively read-only. - mnt.ReadOnly = mnt.ReadOnly || srv.ReadOnly + if srv.ReadOnly { + // All mounts on a read-only service + // are effectively read-only. + mnt.AllowWrite = false + } for class := range mnt.StorageClasses { if mbc := bal.mountsByClass[class]; mbc == nil { @@ -667,7 +669,7 @@ func (bal *Balancer) balanceBlock(blkid arvados.SizedDigest, blk *BlockState) ba slots = append(slots, slot{ mnt: mnt, repl: repl, - want: repl != nil && mnt.ReadOnly, + want: repl != nil && !mnt.AllowTrash, }) } } @@ -756,7 +758,7 @@ func (bal *Balancer) balanceBlock(blkid arvados.SizedDigest, blk *BlockState) ba protMnt[slot.mnt] = true replProt += slot.mnt.Replication } - if replWant < desired && (slot.repl != nil || !slot.mnt.ReadOnly) { + if replWant < desired && (slot.repl != nil || slot.mnt.AllowWrite) { slots[i].want = true wantSrv[slot.mnt.KeepService] = true wantMnt[slot.mnt] = true @@ -875,7 +877,7 @@ func (bal *Balancer) balanceBlock(blkid arvados.SizedDigest, blk *BlockState) ba case slot.repl == nil && slot.want && len(blk.Replicas) == 0: lost = true change = changeNone - case slot.repl == nil && slot.want && !slot.mnt.ReadOnly: + case slot.repl == nil && slot.want && slot.mnt.AllowWrite: slot.mnt.KeepService.AddPull(Pull{ SizedDigest: blkid, From: blk.Replicas[0].KeepMount.KeepService,