getDisksInfo: Attribute failed disks to correct endpoint (#10360)

If DiskInfo calls failed the information returned was used anyway 
resulting in no endpoint being set.

This would make the drive be attributed to the local system since 
`disk.Endpoint == disk.DrivePath` in that case.

Instead, if the call fails record the endpoint and the error only.
master
Klaus Post 4 years ago committed by GitHub
parent 7778fef6bb
commit 1b119557c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      cmd/admin-handlers.go
  2. 5
      cmd/erasure.go

@ -1499,6 +1499,9 @@ func (a adminAPIHandlers) ServerInfoHandler(w http.ResponseWriter, r *http.Reque
} }
// add all the disks local to this server. // add all the disks local to this server.
for _, disk := range storageInfo.Disks { for _, disk := range storageInfo.Disks {
if disk.DrivePath == "" && disk.Endpoint == "" {
continue
}
if disk.Endpoint == disk.DrivePath { if disk.Endpoint == disk.DrivePath {
servers[len(servers)-1].Disks = append(servers[len(servers)-1].Disks, disk) servers[len(servers)-1].Disks = append(servers[len(servers)-1].Disks, disk)
} }

@ -146,6 +146,11 @@ func getDisksInfo(disks []StorageAPI, endpoints []string) (disksInfo []madmin.Di
ctx := logger.SetReqInfo(GlobalContext, reqInfo) ctx := logger.SetReqInfo(GlobalContext, reqInfo)
logger.LogIf(ctx, err) logger.LogIf(ctx, err)
} }
disksInfo[index] = madmin.Disk{
State: diskErrToDriveState(err),
Endpoint: endpoints[index],
}
return err
} }
di := madmin.Disk{ di := madmin.Disk{
Endpoint: endpoints[index], Endpoint: endpoints[index],

Loading…
Cancel
Save