diff --git a/tests/qemu-iotests/041 b/tests/qemu-iotests/041
index 8568426311..5cf2e2cb52 100755
--- a/tests/qemu-iotests/041
+++ b/tests/qemu-iotests/041
@@ -21,7 +21,7 @@
 import time
 import os
 import iotests
-from iotests import qemu_img, qemu_io
+from iotests import create_test_image, remove_test_image, qemu_img, qemu_io
 
 backing_img = os.path.join(iotests.test_dir, 'backing.img')
 target_backing_img = os.path.join(iotests.test_dir, 'target-backing.img')
@@ -41,7 +41,7 @@ class TestSingleDrive(iotests.QMPTestCase):
 
     def setUp(self):
         iotests.create_image(backing_img, self.image_len)
-        qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=%s' % backing_img, test_img)
+        create_test_image(test_img, backing_file=backing_img)
         self.vm = iotests.VM().add_drive(test_img, "node-name=top,backing.node-name=base")
         if iotests.qemu_default_machine == 'pc':
             self.vm.add_drive(None, 'media=cdrom', 'ide')
@@ -49,12 +49,9 @@ class TestSingleDrive(iotests.QMPTestCase):
 
     def tearDown(self):
         self.vm.shutdown()
-        os.remove(test_img)
+        remove_test_image(test_img)
         os.remove(backing_img)
-        try:
-            os.remove(target_img)
-        except OSError:
-            pass
+        remove_test_image(target_img)
 
     def test_complete(self):
         self.assert_no_active_block_jobs()
@@ -138,8 +135,8 @@ class TestSingleDrive(iotests.QMPTestCase):
     def test_small_buffer2(self):
         self.assert_no_active_block_jobs()
 
-        qemu_img('create', '-f', iotests.imgfmt, '-o', 'cluster_size=%d,size=%d'
-                        % (self.image_len, self.image_len), target_img)
+        create_test_image(target_img, self.image_len,
+                          opts=['cluster_size=%d' % self.image_len])
         result = self.vm.qmp(self.qmp_cmd, device='drive0', sync='full',
                              buf_size=65536, mode='existing', target=self.qmp_target)
         self.assert_qmp(result, 'return', {})
@@ -154,8 +151,8 @@ class TestSingleDrive(iotests.QMPTestCase):
     def test_large_cluster(self):
         self.assert_no_active_block_jobs()
 
-        qemu_img('create', '-f', iotests.imgfmt, '-o', 'cluster_size=%d,backing_file=%s'
-                        % (self.image_len, backing_img), target_img)
+        create_test_image(target_img, backing_file=backing_img,
+                          opts=['cluster_size=%d' % self.image_len])
         result = self.vm.qmp(self.qmp_cmd, device='drive0', sync='full',
                              mode='existing', target=self.qmp_target)
         self.assert_qmp(result, 'return', {})
@@ -227,7 +224,7 @@ class TestSingleBlockdev(TestSingleDrive):
 
     def setUp(self):
         TestSingleDrive.setUp(self)
-        qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=%s' % backing_img, target_img)
+        create_test_image(target_img, backing_file=backing_img)
         args = {'driver': iotests.imgfmt,
                 'node-name': self.qmp_target,
                 'file': { 'filename': target_img, 'driver': 'file' } }
@@ -265,24 +262,21 @@ class TestMirrorNoBacking(iotests.QMPTestCase):
 
     def setUp(self):
         iotests.create_image(backing_img, TestMirrorNoBacking.image_len)
-        qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=%s' % backing_img, test_img)
+        create_test_image(test_img, backing_file=backing_img)
         self.vm = iotests.VM().add_drive(test_img)
         self.vm.launch()
 
     def tearDown(self):
         self.vm.shutdown()
-        os.remove(test_img)
+        remove_test_image(test_img)
         os.remove(backing_img)
-        try:
-            os.remove(target_backing_img)
-        except:
-            pass
-        os.remove(target_img)
+        remove_test_image(target_backing_img)
+        remove_test_image(target_img)
 
     def test_complete(self):
         self.assert_no_active_block_jobs()
 
-        qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=%s' % backing_img, target_img)
+        create_test_image(target_img, backing_file=backing_img)
         result = self.vm.qmp('drive-mirror', device='drive0', sync='full',
                              mode='existing', target=target_img)
         self.assert_qmp(result, 'return', {})
@@ -297,7 +291,7 @@ class TestMirrorNoBacking(iotests.QMPTestCase):
     def test_cancel(self):
         self.assert_no_active_block_jobs()
 
-        qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=%s' % backing_img, target_img)
+        create_test_image(target_img, backing_file=backing_img)
         result = self.vm.qmp('drive-mirror', device='drive0', sync='full',
                              mode='existing', target=target_img)
         self.assert_qmp(result, 'return', {})
@@ -313,10 +307,9 @@ class TestMirrorNoBacking(iotests.QMPTestCase):
         self.assert_no_active_block_jobs()
 
         # qemu-img create fails if the image is not there
-        qemu_img('create', '-f', iotests.imgfmt, '-o', 'size=%d'
-                        %(TestMirrorNoBacking.image_len), target_backing_img)
-        qemu_img('create', '-f', iotests.imgfmt, '-o', 'cluster_size=%d,backing_file=%s'
-                        % (TestMirrorNoBacking.image_len, target_backing_img), target_img)
+        create_test_image(target_backing_img, TestMirrorNoBacking.image_len)
+        create_test_image(target_img, backing_file=target_backing_img,
+                          opts=['cluster_size=%d' % TestMirrorNoBacking.image_len])
 
         result = self.vm.qmp('drive-mirror', device='drive0', sync='full',
                              mode='existing', target=target_img)
@@ -335,14 +328,14 @@ class TestMirrorResized(iotests.QMPTestCase):
 
     def setUp(self):
         iotests.create_image(backing_img, TestMirrorResized.backing_len)
-        qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=%s' % backing_img, test_img)
+        create_test_image(test_img, backing_file=backing_img)
         qemu_img('resize', test_img, '2M')
         self.vm = iotests.VM().add_drive(test_img)
         self.vm.launch()
 
     def tearDown(self):
         self.vm.shutdown()
-        os.remove(test_img)
+        remove_test_image(test_img)
         os.remove(backing_img)
         try:
             os.remove(target_img)
@@ -407,14 +400,15 @@ new_state = "1"
 ''' % (event, errno, self.MIRROR_GRANULARITY // 512, event, event))
         file.close()
 
+    # blkdebug does not work with an external data file
+    @iotests.skip_for_imgopts(['data_file'])
     def setUp(self):
         self.blkdebug_file = backing_img + ".blkdebug"
         iotests.create_image(backing_img, TestReadErrors.image_len)
         self.create_blkdebug_file(self.blkdebug_file, "read_aio", 5)
-        qemu_img('create', '-f', iotests.imgfmt,
-                 '-o', 'backing_file=blkdebug:%s:%s,backing_fmt=raw'
-                       % (self.blkdebug_file, backing_img),
-                 test_img)
+        create_test_image(test_img, backing_fmt='raw',
+                          backing_file=('blkdebug:%s:%s' % (self.blkdebug_file,
+                                                            backing_img)))
         # Write something for tests that use sync='top'
         qemu_io('-c', 'write %d 512' % (self.MIRROR_GRANULARITY + 65536),
                         test_img)
@@ -423,8 +417,8 @@ new_state = "1"
 
     def tearDown(self):
         self.vm.shutdown()
-        os.remove(test_img)
-        os.remove(target_img)
+        remove_test_image(test_img)
+        remove_test_image(target_img)
         os.remove(backing_img)
         os.remove(self.blkdebug_file)
 
@@ -483,7 +477,8 @@ new_state = "1"
         # Test COW into the target image.  The first half of the
         # cluster at MIRROR_GRANULARITY has to be copied from
         # backing_img, even though sync='top'.
-        qemu_img('create', '-f', iotests.imgfmt, '-ocluster_size=131072,backing_file=%s' %(backing_img), target_img)
+        create_test_image(target_img, backing_file=backing_img,
+                          opts=['cluster_size=131072'])
         result = self.vm.qmp('drive-mirror', device='drive0', sync='top',
                              on_source_error='ignore',
                              mode='existing', target=target_img)
@@ -572,20 +567,22 @@ new_state = "1"
 ''' % (event, errno, self.MIRROR_GRANULARITY // 512, event, event))
         file.close()
 
+    # blkdebug does not work with an external data file
+    @iotests.skip_for_imgopts(['data_file'])
     def setUp(self):
         self.blkdebug_file = target_img + ".blkdebug"
         iotests.create_image(backing_img, TestWriteErrors.image_len)
         self.create_blkdebug_file(self.blkdebug_file, "write_aio", 5)
-        qemu_img('create', '-f', iotests.imgfmt, '-obacking_file=%s' %(backing_img), test_img)
+        create_test_image(test_img, backing_file=backing_img)
         self.vm = iotests.VM().add_drive(test_img)
         self.target_img = 'blkdebug:%s:%s' % (self.blkdebug_file, target_img)
-        qemu_img('create', '-f', iotests.imgfmt, '-osize=%d' %(TestWriteErrors.image_len), target_img)
+        create_test_image(target_img, TestWriteErrors.image_len)
         self.vm.launch()
 
     def tearDown(self):
         self.vm.shutdown()
-        os.remove(test_img)
-        os.remove(target_img)
+        remove_test_image(test_img)
+        remove_test_image(target_img)
         os.remove(backing_img)
         os.remove(self.blkdebug_file)
 
@@ -673,15 +670,15 @@ class TestSetSpeed(iotests.QMPTestCase):
     image_len = 80 * 1024 * 1024 # MB
 
     def setUp(self):
-        qemu_img('create', backing_img, str(TestSetSpeed.image_len))
-        qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=%s' % backing_img, test_img)
+        create_test_image(backing_img, TestSetSpeed.image_len)
+        create_test_image(test_img, backing_file=backing_img)
         self.vm = iotests.VM().add_drive(test_img)
         self.vm.launch()
 
     def tearDown(self):
         self.vm.shutdown()
-        os.remove(test_img)
-        os.remove(backing_img)
+        remove_test_image(test_img)
+        remove_test_image(backing_img)
         os.remove(target_img)
 
     def test_set_speed(self):
@@ -739,8 +736,7 @@ class TestUnbackedSource(iotests.QMPTestCase):
     image_len = 2 * 1024 * 1024 # MB
 
     def setUp(self):
-        qemu_img('create', '-f', iotests.imgfmt, test_img,
-                 str(TestUnbackedSource.image_len))
+        create_test_image(test_img, TestUnbackedSource.image_len)
         self.vm = iotests.VM()
         self.vm.launch()
         result = self.vm.qmp('blockdev-add', node_name='drive0',
@@ -753,8 +749,8 @@ class TestUnbackedSource(iotests.QMPTestCase):
 
     def tearDown(self):
         self.vm.shutdown()
-        os.remove(test_img)
-        os.remove(target_img)
+        remove_test_image(test_img)
+        remove_test_image(target_img)
 
     def test_absolute_paths_full(self):
         self.assert_no_active_block_jobs()
@@ -784,8 +780,7 @@ class TestUnbackedSource(iotests.QMPTestCase):
         self.assert_no_active_block_jobs()
 
     def test_existing_full(self):
-        qemu_img('create', '-f', iotests.imgfmt, target_img,
-                 str(self.image_len))
+        create_test_image(target_img, self.image_len)
         qemu_io('-c', 'write -P 42 0 64k', target_img)
 
         self.assert_no_active_block_jobs()
@@ -802,8 +797,7 @@ class TestUnbackedSource(iotests.QMPTestCase):
                         'target image does not match source after mirroring')
 
     def test_blockdev_full(self):
-        qemu_img('create', '-f', iotests.imgfmt, target_img,
-                 str(self.image_len))
+        create_test_image(target_img, self.image_len)
         qemu_io('-c', 'write -P 42 0 64k', target_img)
 
         result = self.vm.qmp('blockdev-add', node_name='target',
@@ -834,8 +828,7 @@ class TestGranularity(iotests.QMPTestCase):
     image_len = 10 * 1024 * 1024 # MB
 
     def setUp(self):
-        qemu_img('create', '-f', iotests.imgfmt, test_img,
-                 str(TestGranularity.image_len))
+        create_test_image(test_img, TestGranularity.image_len)
         qemu_io('-c', 'write 0 %d' % (self.image_len),
                 test_img)
         self.vm = iotests.VM().add_drive(test_img)
@@ -845,7 +838,7 @@ class TestGranularity(iotests.QMPTestCase):
         self.vm.shutdown()
         self.assertTrue(iotests.compare_images(test_img, target_img),
                         'target image does not match source after mirroring')
-        os.remove(test_img)
+        remove_test_image(test_img)
         os.remove(target_img)
 
     def test_granularity(self):
@@ -879,8 +872,7 @@ class TestRepairQuorum(iotests.QMPTestCase):
 
         # Add each individual quorum images
         for i in self.IMAGES:
-            qemu_img('create', '-f', iotests.imgfmt, i,
-                     str(TestSingleDrive.image_len))
+            create_test_image(i, TestSingleDrive.image_len)
             # Assign a node name to each quorum image in order to manipulate
             # them
             opts = "node-name=img%i" % self.IMAGES.index(i)
@@ -898,8 +890,10 @@ class TestRepairQuorum(iotests.QMPTestCase):
 
     def tearDown(self):
         self.vm.shutdown()
-        for i in self.IMAGES + [ quorum_repair_img, quorum_snapshot_file ]:
-            # Do a try/except because the test may have deleted some images
+        for i in self.IMAGES:
+            remove_test_image(i)
+
+        for i in [ quorum_repair_img, quorum_snapshot_file ]:
             try:
                 os.remove(i)
             except OSError:
