Skip to content

Commit

Permalink
MGMT-11885: disk_speed_check: escape colons when calling fio (openshi…
Browse files Browse the repository at this point in the history
…ft#427)

fio's filename can be a colon-separated list of devices to test. This however breaks some paths with colons, so these need to be escaped. See https://fio.readthedocs.io/en/latest/fio_doc.html#cmdoption-arg-filename

Previously `fio` was creating `/dev/disk/by-path/pci-0000` for `/dev/disk/by-path/pci-0000:06:0000.0` disk, which was
a) testing the wrong disk speed and
b) could fill up the root partition
  • Loading branch information
vrutkovs committed Sep 2, 2022
1 parent a81a9fd commit 3f0e7e2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/disk_speed_check/disk_speed_check.go
Expand Up @@ -2,6 +2,7 @@ package disk_speed_check

import (
"encoding/json"
"strings"
"sync"
"time"

Expand Down Expand Up @@ -100,7 +101,9 @@ func (p *DiskSpeedCheck) getDiskPerf(path string) fioCheckResponse {
return fioCheckResponse{latency: time.Duration(dryModeSyncDurationInNS).Milliseconds(), err: nil}
}

args := []string{"--filename", path, "--name=test", "--rw=write", "--ioengine=sync",
// FIO treats colons as multiple device separator, which breaks paths like /dev/disk/by-path/pci-0000:06:0000.0
escaped_path := strings.ReplaceAll(path, ":", "\\:")
args := []string{"--filename", escaped_path, "--name=test", "--rw=write", "--ioengine=sync",
"--size=22m", "-bs=2300", "--fdatasync=1", "--output-format=json"}
stdout, stderr, exitCode := p.dependecies.Execute("fio", args...)
if exitCode != 0 {
Expand Down

0 comments on commit 3f0e7e2

Please sign in to comment.