Do not append the endpoint for fs/xl disks in StorageInfo (#8472)

This commit is contained in:
Praveen raj Mani
2019-10-31 21:43:54 +05:30
committed by kannappanr
parent eac518b178
commit fa325665b1
4 changed files with 17 additions and 5 deletions

View File

@@ -99,6 +99,10 @@ func getDisksInfo(disks []StorageAPI) (disksInfo []DiskInfo, onlineDisks, offlin
getPeerAddress := func(diskPath string) (string, error) {
hostPort := strings.Split(diskPath, SlashSeparator)[0]
// Host will be empty for xl/fs disk paths.
if hostPort == "" {
return "", nil
}
thisAddr, err := xnet.ParseHost(hostPort)
if err != nil {
return "", err
@@ -111,6 +115,7 @@ func getDisksInfo(disks []StorageAPI) (disksInfo []DiskInfo, onlineDisks, offlin
// Wait for the routines.
for i, err := range g.Wait() {
peerAddr, pErr := getPeerAddress(disksInfo[i].RelativePath)
if pErr != nil {
continue
}
@@ -122,6 +127,7 @@ func getDisksInfo(disks []StorageAPI) (disksInfo []DiskInfo, onlineDisks, offlin
}
if err != nil {
offlineDisks[peerAddr]++
continue
}
onlineDisks[peerAddr]++
}