From a7466eeb0eee927c6b99a7906a6332c9cb8b2673 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Mon, 13 Nov 2023 22:32:08 -0800 Subject: [PATCH] fix: ignore dperf on unformatted/unavailable/unmounted drives (#18435) --- cmd/speedtest.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/cmd/speedtest.go b/cmd/speedtest.go index a4c0c06dd..71f83c07f 100644 --- a/cmd/speedtest.go +++ b/cmd/speedtest.go @@ -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 {