fix: skip local disks properly in cluster health maintenance check (#19184)

This commit is contained in:
Harshavardhana 2024-03-04 20:48:44 -08:00 committed by GitHub
parent b69bcdcdc4
commit 1b5f28e99b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 14 additions and 2 deletions

View File

@ -2318,8 +2318,19 @@ func (z *erasureServerPools) Health(ctx context.Context, opts HealthOptions) Hea
storageInfo := z.StorageInfo(ctx, false)
for _, disk := range storageInfo.Disks {
if disk.Local && opts.Maintenance {
continue
if opts.Maintenance {
var skip bool
globalLocalDrivesMu.RLock()
for _, drive := range globalLocalDrives {
if drive != nil && drive.Endpoint().String() == disk.Endpoint {
skip = true
break
}
}
globalLocalDrivesMu.RUnlock()
if skip {
continue
}
}
if disk.PoolIndex > -1 && disk.SetIndex > -1 {
@ -2426,6 +2437,7 @@ func (z *erasureServerPools) Health(ctx context.Context, opts HealthOptions) Hea
if opts.Maintenance {
result.Healthy = result.Healthy && drivesHealing == 0
result.HealthyRead = result.HealthyRead && drivesHealing == 0
result.HealingDrives = drivesHealing
}