mirror of https://github.com/minio/minio.git
Check pool-index for invalid setups (#16501)
This commit is contained in:
parent
67fce4a5b3
commit
b923a62425
|
@ -133,6 +133,11 @@ func (z *erasureServerPools) initRebalanceMeta(ctx context.Context, buckets []st
|
||||||
}, len(z.serverPools))
|
}, len(z.serverPools))
|
||||||
var totalCap, totalFree uint64
|
var totalCap, totalFree uint64
|
||||||
for _, disk := range si.Disks {
|
for _, disk := range si.Disks {
|
||||||
|
// Ignore invalid.
|
||||||
|
if disk.PoolIndex < 0 || len(diskStats) <= disk.PoolIndex {
|
||||||
|
// https://github.com/minio/minio/issues/16500
|
||||||
|
continue
|
||||||
|
}
|
||||||
totalCap += disk.TotalSpace
|
totalCap += disk.TotalSpace
|
||||||
totalFree += disk.AvailableSpace
|
totalFree += disk.AvailableSpace
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,11 @@ func GetTotalCapacity(diskInfo []madmin.Disk) (capacity uint64) {
|
||||||
// GetTotalUsableCapacity gets the total usable capacity in the cluster.
|
// GetTotalUsableCapacity gets the total usable capacity in the cluster.
|
||||||
func GetTotalUsableCapacity(diskInfo []madmin.Disk, s StorageInfo) (capacity uint64) {
|
func GetTotalUsableCapacity(diskInfo []madmin.Disk, s StorageInfo) (capacity uint64) {
|
||||||
for _, disk := range diskInfo {
|
for _, disk := range diskInfo {
|
||||||
|
// Ignore invalid.
|
||||||
|
if disk.PoolIndex < 0 || len(s.Backend.StandardSCData) <= disk.PoolIndex {
|
||||||
|
// https://github.com/minio/minio/issues/16500
|
||||||
|
continue
|
||||||
|
}
|
||||||
// Ignore parity disks
|
// Ignore parity disks
|
||||||
if disk.DiskIndex < s.Backend.StandardSCData[disk.PoolIndex] {
|
if disk.DiskIndex < s.Backend.StandardSCData[disk.PoolIndex] {
|
||||||
capacity += disk.TotalSpace
|
capacity += disk.TotalSpace
|
||||||
|
@ -51,6 +56,11 @@ func GetTotalCapacityFree(diskInfo []madmin.Disk) (capacity uint64) {
|
||||||
// GetTotalUsableCapacityFree gets the total usable capacity free in the cluster.
|
// GetTotalUsableCapacityFree gets the total usable capacity free in the cluster.
|
||||||
func GetTotalUsableCapacityFree(diskInfo []madmin.Disk, s StorageInfo) (capacity uint64) {
|
func GetTotalUsableCapacityFree(diskInfo []madmin.Disk, s StorageInfo) (capacity uint64) {
|
||||||
for _, disk := range diskInfo {
|
for _, disk := range diskInfo {
|
||||||
|
// Ignore invalid.
|
||||||
|
if disk.PoolIndex < 0 || len(s.Backend.StandardSCData) <= disk.PoolIndex {
|
||||||
|
// https://github.com/minio/minio/issues/16500
|
||||||
|
continue
|
||||||
|
}
|
||||||
// Ignore parity disks
|
// Ignore parity disks
|
||||||
if disk.DiskIndex < s.Backend.StandardSCData[disk.PoolIndex] {
|
if disk.DiskIndex < s.Backend.StandardSCData[disk.PoolIndex] {
|
||||||
capacity += disk.AvailableSpace
|
capacity += disk.AvailableSpace
|
||||||
|
|
|
@ -61,6 +61,11 @@ func rebalanceStatus(ctx context.Context, z *erasureServerPools) (r rebalanceAdm
|
||||||
TotalSpace uint64
|
TotalSpace uint64
|
||||||
}, len(z.serverPools))
|
}, len(z.serverPools))
|
||||||
for _, disk := range si.Disks {
|
for _, disk := range si.Disks {
|
||||||
|
// Ignore invalid.
|
||||||
|
if disk.PoolIndex < 0 || len(diskStats) <= disk.PoolIndex {
|
||||||
|
// https://github.com/minio/minio/issues/16500
|
||||||
|
continue
|
||||||
|
}
|
||||||
diskStats[disk.PoolIndex].AvailableSpace += disk.AvailableSpace
|
diskStats[disk.PoolIndex].AvailableSpace += disk.AvailableSpace
|
||||||
diskStats[disk.PoolIndex].TotalSpace += disk.TotalSpace
|
diskStats[disk.PoolIndex].TotalSpace += disk.TotalSpace
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue