fix: ignore dperf on unformatted/unavailable/unmounted drives (#18435)

This commit is contained in:
Harshavardhana 2023-11-13 22:32:08 -08:00 committed by GitHub
parent 8b1e819bf3
commit a7466eeb0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -238,9 +238,15 @@ func driveSpeedTest(ctx context.Context, opts madmin.DriveSpeedTestOpts) madmin.
}
localPaths := globalEndpoints.LocalDisksPaths()
var ignoredPaths []string
paths := func() (tmpPaths []string) {
for _, lp := range localPaths {
tmpPaths = append(tmpPaths, pathJoin(lp, minioMetaTmpBucket))
if _, err := Lstat(pathJoin(lp, minioMetaBucket, formatConfigFile)); err == nil {
tmpPaths = append(tmpPaths, pathJoin(lp, minioMetaTmpBucket))
} else {
// Use dperf on only formatted drives.
ignoredPaths = append(ignoredPaths, lp)
}
}
return tmpPaths
}()
@ -274,6 +280,12 @@ func driveSpeedTest(ctx context.Context, opts madmin.DriveSpeedTestOpts) madmin.
}
results = append(results, result)
}
for _, inp := range ignoredPaths {
results = append(results, madmin.DrivePerf{
Path: inp,
Error: errFaultyDisk.Error(),
})
}
return results
}(),
Error: func() string {