add cluster maintenance healthcheck drive heal affinity (#10218)

This commit is contained in:
Harshavardhana
2020-08-07 13:22:53 -07:00
committed by GitHub
parent 19c4f3082b
commit 6c6137b2e7
10 changed files with 194 additions and 96 deletions

View File

@@ -2032,6 +2032,7 @@ type HealthOptions struct {
// was queried
type HealthResult struct {
Healthy bool
HealingDrives int
ZoneID, SetID int
WriteQuorum int
}
@@ -2086,8 +2087,23 @@ func (z *erasureZones) Health(ctx context.Context, opts HealthOptions) HealthRes
}
}
}
// check if local disks are being healed, if they are being healed
// we need to tell healthy status as 'false' so that this server
// is not taken down for maintenance
aggHealStateResult, err := getAggregatedBackgroundHealState(ctx, true)
if err != nil {
logger.LogIf(ctx, fmt.Errorf("Unable to verify global heal status: %w", err))
return HealthResult{
Healthy: false,
}
}
healthy := len(aggHealStateResult.HealDisks) == 0
return HealthResult{
Healthy: true,
Healthy: healthy,
HealingDrives: len(aggHealStateResult.HealDisks),
}
}