@@ -24,7 +24,7 @@ import re
import iotests
import copy
import json
-from iotests import qemu_img, qemu_io
+from iotests import create_test_image, remove_test_image, qemu_io
hd_path = [
os.path.join(iotests.test_dir, 'hd0.img'),
@@ -43,9 +43,9 @@ class TestBlockdevReopen(iotests.QMPTestCase):
total_io_cmds = 0
def setUp(self):
- qemu_img('create', '-f', iotests.imgfmt, hd_path[0], '3M')
- qemu_img('create', '-f', iotests.imgfmt, '-b', hd_path[0], hd_path[1])
- qemu_img('create', '-f', iotests.imgfmt, hd_path[2], '3M')
+ create_test_image(hd_path[0], '3M')
+ create_test_image(hd_path[1], backing_file=hd_path[0])
+ create_test_image(hd_path[2], '3M')
qemu_io('-f', iotests.imgfmt, '-c', 'write -P 0xa0 0 1M', hd_path[0])
qemu_io('-f', iotests.imgfmt, '-c', 'write -P 0xa1 1M 1M', hd_path[1])
qemu_io('-f', iotests.imgfmt, '-c', 'write -P 0xa2 2M 1M', hd_path[2])
@@ -55,9 +55,9 @@ class TestBlockdevReopen(iotests.QMPTestCase):
def tearDown(self):
self.vm.shutdown()
self.check_qemu_io_errors()
- os.remove(hd_path[0])
- os.remove(hd_path[1])
- os.remove(hd_path[2])
+ remove_test_image(hd_path[0])
+ remove_test_image(hd_path[1])
+ remove_test_image(hd_path[2])
# The output of qemu-io is not returned by vm.hmp_qemu_io() but
# it's stored in the log and can only be read when the VM has been
@@ -328,7 +328,8 @@ class TestBlockdevReopen(iotests.QMPTestCase):
# First we create a 2MB raw file, and fill each half with a
# different value
- qemu_img('create', '-f', 'raw', hd_path[0], '2M')
+ remove_test_image(hd_path[0])
+ create_test_image(hd_path[0], '2M', fmt='raw')
qemu_io('-f', 'raw', '-c', 'write -P 0xa0 0 1M', hd_path[0])
qemu_io('-f', 'raw', '-c', 'write -P 0xa1 1M 1M', hd_path[0])
Signed-off-by: Max Reitz <mreitz@redhat.com> --- tests/qemu-iotests/245 | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)