mirror of
https://github.com/minio/minio.git
synced 2025-02-26 04:49:16 -05:00
fix: crash in metrics handler when some disks are offline (#9450)
Fixes #9449
This commit is contained in:
parent
4843affd0e
commit
6ecc98fddb
19
cmd/xl-v1.go
19
cmd/xl-v1.go
@ -175,20 +175,21 @@ func getStorageInfo(disks []StorageAPI, endpoints Endpoints) StorageInfo {
|
|||||||
|
|
||||||
// StorageInfo - returns underlying storage statistics.
|
// StorageInfo - returns underlying storage statistics.
|
||||||
func (xl xlObjects) StorageInfo(ctx context.Context, local bool) StorageInfo {
|
func (xl xlObjects) StorageInfo(ctx context.Context, local bool) StorageInfo {
|
||||||
var endpoints = xl.endpoints
|
|
||||||
var disks []StorageAPI
|
|
||||||
|
|
||||||
if !local {
|
disks := xl.getDisks()
|
||||||
disks = xl.getDisks()
|
if local {
|
||||||
} else {
|
var localDisks []StorageAPI
|
||||||
for i, d := range xl.getDisks() {
|
for i, disk := range disks {
|
||||||
if endpoints[i].IsLocal && d.Hostname() == "" {
|
if disk != nil {
|
||||||
|
if xl.endpoints[i].IsLocal && disk.Hostname() == "" {
|
||||||
// Append this local disk since local flag is true
|
// Append this local disk since local flag is true
|
||||||
disks = append(disks, d)
|
localDisks = append(localDisks, disk)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return getStorageInfo(disks, endpoints)
|
disks = localDisks
|
||||||
|
}
|
||||||
|
return getStorageInfo(disks, xl.endpoints)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetMetrics - is not implemented and shouldn't be called.
|
// GetMetrics - is not implemented and shouldn't be called.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user