From 1b119557c2034e89c506ffe13bfd4a4fcfa1c508 Mon Sep 17 00:00:00 2001 From: Klaus Post Date: Wed, 26 Aug 2020 10:11:26 -0700 Subject: [PATCH] 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. --- cmd/admin-handlers.go | 3 +++ cmd/erasure.go | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/cmd/admin-handlers.go b/cmd/admin-handlers.go index ea89e170c..f78d8c6ec 100644 --- a/cmd/admin-handlers.go +++ b/cmd/admin-handlers.go @@ -1499,6 +1499,9 @@ func (a adminAPIHandlers) ServerInfoHandler(w http.ResponseWriter, r *http.Reque } // add all the disks local to this server. for _, disk := range storageInfo.Disks { + if disk.DrivePath == "" && disk.Endpoint == "" { + continue + } if disk.Endpoint == disk.DrivePath { servers[len(servers)-1].Disks = append(servers[len(servers)-1].Disks, disk) } diff --git a/cmd/erasure.go b/cmd/erasure.go index f0f96267c..2847e4ddc 100644 --- a/cmd/erasure.go +++ b/cmd/erasure.go @@ -146,6 +146,11 @@ func getDisksInfo(disks []StorageAPI, endpoints []string) (disksInfo []madmin.Di ctx := logger.SetReqInfo(GlobalContext, reqInfo) logger.LogIf(ctx, err) } + disksInfo[index] = madmin.Disk{ + State: diskErrToDriveState(err), + Endpoint: endpoints[index], + } + return err } di := madmin.Disk{ Endpoint: endpoints[index],