diff --git a/cmd/speedtest.go b/cmd/speedtest.go index 4706274aa..f548d16cf 100644 --- a/cmd/speedtest.go +++ b/cmd/speedtest.go @@ -19,8 +19,6 @@ package cmd import ( "context" - "os" - "path/filepath" "sort" "time" @@ -28,8 +26,6 @@ import ( "github.com/minio/madmin-go" ) -var dperfUUID = mustGetUUID() - type speedTestOpts struct { throughputSize int concurrencyStart int @@ -171,29 +167,23 @@ func driveSpeedTest(ctx context.Context, opts madmin.DriveSpeedTestOpts) madmin. BlockSize: opts.BlockSize, FileSize: opts.FileSize, } - paths := func() []string { - toRet := []string{} - paths := globalEndpoints.LocalDisksPaths() - for _, p := range paths { - dperfFilename := filepath.Join(p, ".minio.sys", "tmp", dperfUUID) - if _, err := os.Stat(dperfFilename); err == nil { - // file exists, so remove it - os.Remove(dperfFilename) - } - toRet = append(toRet, dperfFilename) + + localPaths := globalEndpoints.LocalDisksPaths() + paths := func() (tmpPaths []string) { + for _, lp := range localPaths { + tmpPaths = append(tmpPaths, pathJoin(lp, minioMetaTmpBucket)) } - return toRet + return tmpPaths }() perfs, err := perf.Run(ctx, paths...) return madmin.DriveSpeedTestResult{ Endpoint: globalLocalNodeName, Version: Version, - DrivePerf: func() []madmin.DrivePerf { - results := []madmin.DrivePerf{} - for _, r := range perfs { + DrivePerf: func() (results []madmin.DrivePerf) { + for idx, r := range perfs { result := madmin.DrivePerf{ - Path: r.Path, + Path: localPaths[idx], ReadThroughput: r.ReadThroughput, WriteThroughput: r.WriteThroughput, Error: func() string { diff --git a/go.mod b/go.mod index 5bab4a325..a7e00c4ea 100644 --- a/go.mod +++ b/go.mod @@ -47,7 +47,7 @@ require ( github.com/minio/cli v1.22.0 github.com/minio/console v0.14.8 github.com/minio/csvparser v1.0.0 - github.com/minio/dperf v0.2.1-0.20220126071331-eefa6468e289 + github.com/minio/dperf v0.3.2 github.com/minio/highwayhash v1.0.2 github.com/minio/kes v0.14.0 github.com/minio/madmin-go v1.3.4 diff --git a/go.sum b/go.sum index 0deb2e625..f817b6cf7 100644 --- a/go.sum +++ b/go.sum @@ -833,8 +833,8 @@ github.com/minio/csvparser v1.0.0 h1:xJEHcYK8ZAjeW4hNV9Zu30u+/2o4UyPnYgyjWp8b7ZU github.com/minio/csvparser v1.0.0/go.mod h1:lKXskSLzPgC5WQyzP7maKH7Sl1cqvANXo9YCto8zbtM= github.com/minio/direct-csi v1.3.5-0.20210601185811-f7776f7961bf h1:wylCc/PdvdTIqYqVNEU9LJAZBanvfGY1TwTnjM3zQaA= github.com/minio/direct-csi v1.3.5-0.20210601185811-f7776f7961bf/go.mod h1:ryRFbKRDMZ1+kGF5EZwuyfF1a/eAu4c9uxZdF0fnmuY= -github.com/minio/dperf v0.2.1-0.20220126071331-eefa6468e289 h1:/xkr1EFJyQIqrXL/eWVSv3tWAbhFsGOQ2HCiabVkvNY= -github.com/minio/dperf v0.2.1-0.20220126071331-eefa6468e289/go.mod h1:eSYYs7XI/TyAWX+ekAmV9kAA85wGqlnSNpkjh+fR/M4= +github.com/minio/dperf v0.3.2 h1:iKTEgXcyncohWh/tLktZ25/9CcxIJfG9pqWvSnozgCc= +github.com/minio/dperf v0.3.2/go.mod h1:mo7rPmlIl3Bgn8CrM0Yjeu3AL3xXVd7sH7Hpj4OGK1E= github.com/minio/filepath v1.0.0 h1:fvkJu1+6X+ECRA6G3+JJETj4QeAYO9sV43I79H8ubDY= github.com/minio/filepath v1.0.0/go.mod h1:/nRZA2ldl5z6jT9/KQuvZcQlxZIMQoFFQPvEXx9T/Bw= github.com/minio/highwayhash v1.0.1/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY=