@@ -21,6 +21,7 @@
import os
import iotests
+from iotests import create_test_image, remove_test_image
import time
base_img = os.path.join(iotests.test_dir, 'base.img')
@@ -33,7 +34,7 @@ else:
class TestBlockdevDel(iotests.QMPTestCase):
def setUp(self):
- iotests.qemu_img('create', '-f', iotests.imgfmt, base_img, '1M')
+ create_test_image(base_img, '1M')
self.vm = iotests.VM()
self.vm.add_device("{},id=virtio-scsi".format(
iotests.get_virtio_scsi_device()))
@@ -41,9 +42,8 @@ class TestBlockdevDel(iotests.QMPTestCase):
def tearDown(self):
self.vm.shutdown()
- os.remove(base_img)
- if os.path.isfile(new_img):
- os.remove(new_img)
+ remove_test_image(base_img)
+ remove_test_image(new_img)
# Check whether a BlockDriverState exists
def checkBlockDriverState(self, node, must_exist = True):
@@ -70,8 +70,7 @@ class TestBlockdevDel(iotests.QMPTestCase):
# Add a BlockDriverState that will be used as overlay for the base_img BDS
def addBlockDriverStateOverlay(self, node):
self.checkBlockDriverState(node, False)
- iotests.qemu_img('create', '-u', '-f', iotests.imgfmt,
- '-b', base_img, new_img, '1M')
+ create_test_image(new_img, '1M', backing_file=base_img, unsafe=True)
opts = {'driver': iotests.imgfmt,
'node-name': node,
'backing': None,
@@ -202,7 +201,7 @@ class TestBlockdevDel(iotests.QMPTestCase):
self.checkBlockDriverState(test, False)
self.checkBlockDriverState(raw, False)
self.checkBlockDriverState(blkverify, False)
- iotests.qemu_img('create', '-f', iotests.imgfmt, new_img, '1M')
+ create_test_image(new_img, '1M')
node_0 = {'driver': iotests.imgfmt,
'node-name': test,
'file': {'driver': 'file',
@@ -226,7 +225,7 @@ class TestBlockdevDel(iotests.QMPTestCase):
self.checkBlockDriverState(child0, False)
self.checkBlockDriverState(child1, False)
self.checkBlockDriverState(quorum, False)
- iotests.qemu_img('create', '-f', iotests.imgfmt, new_img, '1M')
+ create_test_image(new_img, '1M')
child_0 = {'driver': iotests.imgfmt,
'node-name': child0,
'file': {'driver': 'file',
Signed-off-by: Max Reitz <mreitz@redhat.com> --- tests/qemu-iotests/139 | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)