mirror of
https://github.com/minio/minio.git
synced 2025-01-26 06:03:17 -05:00
Add a isErr
function to check for errs.
DisksInfo() should handle collection of some base errors as offlineDisks.
This commit is contained in:
parent
6d10f4c19a
commit
7bbb532b4b
@ -121,12 +121,15 @@ func errorsCause(errs []error) []error {
|
|||||||
return cerrs
|
return cerrs
|
||||||
}
|
}
|
||||||
|
|
||||||
var baseIgnoredErrs = []error{
|
// Collection of basic errors.
|
||||||
|
var baseErrs = []error{
|
||||||
errDiskNotFound,
|
errDiskNotFound,
|
||||||
errFaultyDisk,
|
errFaultyDisk,
|
||||||
errFaultyRemoteDisk,
|
errFaultyRemoteDisk,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var baseIgnoredErrs = baseErrs
|
||||||
|
|
||||||
// isErrIgnored returns whether given error is ignored or not.
|
// isErrIgnored returns whether given error is ignored or not.
|
||||||
func isErrIgnored(err error, ignoredErrs ...error) bool {
|
func isErrIgnored(err error, ignoredErrs ...error) bool {
|
||||||
err = errorCause(err)
|
err = errorCause(err)
|
||||||
@ -137,3 +140,14 @@ func isErrIgnored(err error, ignoredErrs ...error) bool {
|
|||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// isErr returns whether given error is exact error.
|
||||||
|
func isErr(err error, errs ...error) bool {
|
||||||
|
err = errorCause(err)
|
||||||
|
for _, exactErr := range errs {
|
||||||
|
if err == exactErr {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
@ -169,10 +169,10 @@ func getDisksInfo(disks []StorageAPI) (disksInfo []disk.Info, onlineDisks int, o
|
|||||||
info, err := storageDisk.DiskInfo()
|
info, err := storageDisk.DiskInfo()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errorIf(err, "Unable to fetch disk info for %#v", storageDisk)
|
errorIf(err, "Unable to fetch disk info for %#v", storageDisk)
|
||||||
if err == errDiskNotFound {
|
if isErr(err, baseErrs...) {
|
||||||
offlineDisks++
|
offlineDisks++
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
continue
|
|
||||||
}
|
}
|
||||||
onlineDisks++
|
onlineDisks++
|
||||||
disksInfo[i] = info
|
disksInfo[i] = info
|
||||||
|
Loading…
x
Reference in New Issue
Block a user