Browse Source

simplify

pull/7440/head
chrislu 1 month ago
parent
commit
77896dbfaa
  1. 8
      weed/topology/disk.go

8
weed/topology/disk.go

@ -180,12 +180,12 @@ func (d *Disk) doAddOrUpdateVolume(v storage.VolumeInfo) (isNew, isChanged bool)
// Adjust active volume count when ReadOnly status changes // Adjust active volume count when ReadOnly status changes
// Use a separate delta object to avoid affecting other metric adjustments // Use a separate delta object to avoid affecting other metric adjustments
readOnlyDelta := &DiskUsageCounts{} readOnlyDelta := &DiskUsageCounts{}
if !v.ReadOnly && oldV.ReadOnly {
// Changed from read-only to writable
readOnlyDelta.activeVolumeCount = 1
} else if v.ReadOnly && !oldV.ReadOnly {
if v.ReadOnly {
// Changed from writable to read-only // Changed from writable to read-only
readOnlyDelta.activeVolumeCount = -1 readOnlyDelta.activeVolumeCount = -1
} else {
// Changed from read-only to writable
readOnlyDelta.activeVolumeCount = 1
} }
d.UpAdjustDiskUsageDelta(types.ToDiskType(v.DiskType), readOnlyDelta) d.UpAdjustDiskUsageDelta(types.ToDiskType(v.DiskType), readOnlyDelta)
} }

Loading…
Cancel
Save