decom: Fix CurrentSize output when generating the status (#19883)

StartSize starts with the raw free space of all disks in the given pool,
however during the status, CurrentSize is not showing the current free
raw space, as expected at least by `mc admin decom status` since it was
written.
This commit is contained in:
Anis Eleuch 2024-06-06 15:30:43 +01:00 committed by GitHub
parent 44fc707423
commit b94dd835c9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1327,11 +1327,7 @@ func (z *erasureServerPools) Status(ctx context.Context, idx int) (PoolStatus, e
poolInfo := z.poolMeta.Pools[idx].Clone() poolInfo := z.poolMeta.Pools[idx].Clone()
if poolInfo.Decommission != nil { if poolInfo.Decommission != nil {
poolInfo.Decommission.TotalSize = pi.Total poolInfo.Decommission.TotalSize = pi.Total
if poolInfo.Decommission.Failed || poolInfo.Decommission.Canceled { poolInfo.Decommission.CurrentSize = pi.Free
poolInfo.Decommission.CurrentSize = pi.Free
} else {
poolInfo.Decommission.CurrentSize = poolInfo.Decommission.StartSize + poolInfo.Decommission.BytesDone
}
} else { } else {
poolInfo.Decommission = &PoolDecommissionInfo{ poolInfo.Decommission = &PoolDecommissionInfo{
TotalSize: pi.Total, TotalSize: pi.Total,