Skip to content

Commit

Permalink
docker: set rw on block device before hotplug test.
Browse files Browse the repository at this point in the history
rw check on block device is enhanced in qemu 5.1. So block device should be
set to rw using blockdev before hotplug test in docker.
If not, block device hotplug test will fail.

test case:
docker run --rm --runtime kata-runtime --device /dev/loop0 ubuntu ls

more info see https://patchew.org/QEMU/[email protected]/[email protected]/

Fixes: kata-containers#3002
Signed-off-by: Jianyong Wu <[email protected]>
  • Loading branch information
jongwu committed Oct 22, 2020
1 parent dfebc65 commit d5196ee
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions integration/docker/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,13 @@ func createLoopDevice() (string, string, error) {
if len(loopPath) == 0 {
return "", "", fmt.Errorf("Unable to get loop device path, stdout: %s, stderr: %s", stdout, stderr)
}

// set loop device to rw using blockdev --setrw
setrwLoopDevice := tests.NewCommand("blockdev", "--setrw", loopPath[0])
stdout, stderr, exitCode := setrwLoopDevice.Run()
if exitCode != 0 {
return "", "", fmt.Error("exitCode: %d, stdout: %s, stderr: %s ", exitCode, stdout, stderr)
}
return f.Name(), loopPath[0], nil
}

Expand Down

0 comments on commit d5196ee

Please sign in to comment.