@ -60,8 +60,11 @@ func newXLZones(endpointZones EndpointZones) (ObjectLayer, error) {
formats = make ( [ ] * formatXLV3 , len ( endpointZones ) )
formats = make ( [ ] * formatXLV3 , len ( endpointZones ) )
z = & xlZones { zones : make ( [ ] * xlSets , len ( endpointZones ) ) }
z = & xlZones { zones : make ( [ ] * xlSets , len ( endpointZones ) ) }
)
)
local := endpointZones . FirstLocal ( )
for i , ep := range endpointZones {
for i , ep := range endpointZones {
formats [ i ] , err = waitForFormatXL ( endpointZones . FirstLocal ( ) , ep . Endpoints ,
logger . Info ( "Formatting %v zone, %v set(s), %v drives per set." ,
i + 1 , ep . SetCount , ep . DrivesPerSet )
formats [ i ] , err = waitForFormatXL ( local , ep . Endpoints ,
ep . SetCount , ep . DrivesPerSet , deploymentID )
ep . SetCount , ep . DrivesPerSet , deploymentID )
if err != nil {
if err != nil {
return nil , err
return nil , err
@ -69,8 +72,6 @@ func newXLZones(endpointZones EndpointZones) (ObjectLayer, error) {
if deploymentID == "" {
if deploymentID == "" {
deploymentID = formats [ i ] . ID
deploymentID = formats [ i ] . ID
}
}
}
for i , ep := range endpointZones {
z . zones [ i ] , err = newXLSets ( ep . Endpoints , formats [ i ] , ep . SetCount , ep . DrivesPerSet )
z . zones [ i ] , err = newXLSets ( ep . Endpoints , formats [ i ] , ep . SetCount , ep . DrivesPerSet )
if err != nil {
if err != nil {
return nil , err
return nil , err
@ -1261,17 +1262,28 @@ func (z *xlZones) HealFormat(ctx context.Context, dryRun bool) (madmin.HealResul
Type : madmin . HealItemMetadata ,
Type : madmin . HealItemMetadata ,
Detail : "disk-format" ,
Detail : "disk-format" ,
}
}
var countNoHeal int
for _ , zone := range z . zones {
for _ , zone := range z . zones {
result , err := zone . HealFormat ( ctx , dryRun )
result , err := zone . HealFormat ( ctx , dryRun )
if err != nil && err != errNoHealRequired {
if err != nil && err != errNoHealRequired {
logger . LogIf ( ctx , err )
logger . LogIf ( ctx , err )
continue
continue
}
}
// Count errNoHealRequired across all zones,
// to return appropriate error to the caller
if err == errNoHealRequired {
countNoHeal ++
}
r . DiskCount += result . DiskCount
r . DiskCount += result . DiskCount
r . SetCount += result . SetCount
r . SetCount += result . SetCount
r . Before . Drives = append ( r . Before . Drives , result . Before . Drives ... )
r . Before . Drives = append ( r . Before . Drives , result . Before . Drives ... )
r . After . Drives = append ( r . After . Drives , result . After . Drives ... )
r . After . Drives = append ( r . After . Drives , result . After . Drives ... )
}
}
// No heal returned by all zones, return errNoHealRequired
if countNoHeal == len ( z . zones ) {
return r , errNoHealRequired
}
return r , nil
return r , nil
}
}