mirror of
https://github.com/minio/minio.git
synced 2025-04-08 21:55:44 -04:00
heal-info: Return the endpoint of a disk with unknown state (#15854)
This commit is contained in:
parent
44097faec1
commit
db7a9b2c37
@ -107,7 +107,6 @@ func (d byDiskTotal) Less(i, j int) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func diskErrToDriveState(err error) (state string) {
|
func diskErrToDriveState(err error) (state string) {
|
||||||
state = madmin.DriveStateUnknown
|
|
||||||
switch {
|
switch {
|
||||||
case errors.Is(err, errDiskNotFound):
|
case errors.Is(err, errDiskNotFound):
|
||||||
state = madmin.DriveStateOffline
|
state = madmin.DriveStateOffline
|
||||||
@ -121,7 +120,10 @@ func diskErrToDriveState(err error) (state string) {
|
|||||||
state = madmin.DriveStateFaulty
|
state = madmin.DriveStateFaulty
|
||||||
case err == nil:
|
case err == nil:
|
||||||
state = madmin.DriveStateOk
|
state = madmin.DriveStateOk
|
||||||
|
default:
|
||||||
|
state = fmt.Sprintf("%s (cause: %s)", madmin.DriveStateUnknown, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -184,18 +186,19 @@ func getDisksInfo(disks []StorageAPI, endpoints []Endpoint) (disksInfo []madmin.
|
|||||||
for index := range disks {
|
for index := range disks {
|
||||||
index := index
|
index := index
|
||||||
g.Go(func() error {
|
g.Go(func() error {
|
||||||
|
diskEndpoint := endpoints[index].String()
|
||||||
if disks[index] == OfflineDisk {
|
if disks[index] == OfflineDisk {
|
||||||
logger.LogIf(GlobalContext, fmt.Errorf("%s: %s", errDiskNotFound, endpoints[index]))
|
logger.LogIf(GlobalContext, fmt.Errorf("%s: %s", errDiskNotFound, endpoints[index]))
|
||||||
disksInfo[index] = madmin.Disk{
|
disksInfo[index] = madmin.Disk{
|
||||||
State: diskErrToDriveState(errDiskNotFound),
|
State: diskErrToDriveState(errDiskNotFound),
|
||||||
Endpoint: endpoints[index].String(),
|
Endpoint: diskEndpoint,
|
||||||
}
|
}
|
||||||
// Storage disk is empty, perhaps ignored disk or not available.
|
// Storage disk is empty, perhaps ignored disk or not available.
|
||||||
return errDiskNotFound
|
return errDiskNotFound
|
||||||
}
|
}
|
||||||
info, err := disks[index].DiskInfo(context.TODO())
|
info, err := disks[index].DiskInfo(context.TODO())
|
||||||
di := madmin.Disk{
|
di := madmin.Disk{
|
||||||
Endpoint: info.Endpoint,
|
Endpoint: diskEndpoint,
|
||||||
DrivePath: info.MountPath,
|
DrivePath: info.MountPath,
|
||||||
TotalSpace: info.Total,
|
TotalSpace: info.Total,
|
||||||
UsedSpace: info.Used,
|
UsedSpace: info.Used,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user