diff options
author | Fam Zheng <famz@redhat.com> | 2017-05-03 00:35:44 +0800 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2017-05-11 11:08:40 +0200 |
commit | 4797aeabdc61d7bbf9ef0cb9e25fb539912bb7f3 (patch) | |
tree | 46431fc921c1d0f6d5ed9921871b18e8bd97e8e9 /tests/qemu-iotests | |
parent | 55e5a3b65e3e8bdf2fe5e22bbd8c0c4023cef1c2 (diff) |
iotests: 055: Don't attach the target image already for drive-backup
Double attach is not a valid usage of the target image, drive-backup
will open the blockdev itself so skip the add_drive call in this case.
Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'tests/qemu-iotests')
-rwxr-xr-x | tests/qemu-iotests/055 | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/tests/qemu-iotests/055 b/tests/qemu-iotests/055 index aafcd249f6..ba4da65c77 100755 --- a/tests/qemu-iotests/055 +++ b/tests/qemu-iotests/055 @@ -458,17 +458,18 @@ class TestDriveCompression(iotests.QMPTestCase): except OSError: pass - def do_prepare_drives(self, fmt, args): + def do_prepare_drives(self, fmt, args, attach_target): self.vm = iotests.VM().add_drive(test_img) qemu_img('create', '-f', fmt, blockdev_target_img, str(TestDriveCompression.image_len), *args) - self.vm.add_drive(blockdev_target_img, format=fmt, interface="none") + if attach_target: + self.vm.add_drive(blockdev_target_img, format=fmt, interface="none") self.vm.launch() - def do_test_compress_complete(self, cmd, format, **args): - self.do_prepare_drives(format['type'], format['args']) + def do_test_compress_complete(self, cmd, format, attach_target, **args): + self.do_prepare_drives(format['type'], format['args'], attach_target) self.assert_no_active_block_jobs() @@ -484,15 +485,16 @@ class TestDriveCompression(iotests.QMPTestCase): def test_complete_compress_drive_backup(self): for format in TestDriveCompression.fmt_supports_compression: - self.do_test_compress_complete('drive-backup', format, + self.do_test_compress_complete('drive-backup', format, False, target=blockdev_target_img, mode='existing') def test_complete_compress_blockdev_backup(self): for format in TestDriveCompression.fmt_supports_compression: - self.do_test_compress_complete('blockdev-backup', format, target='drive1') + self.do_test_compress_complete('blockdev-backup', format, True, + target='drive1') - def do_test_compress_cancel(self, cmd, format, **args): - self.do_prepare_drives(format['type'], format['args']) + def do_test_compress_cancel(self, cmd, format, attach_target, **args): + self.do_prepare_drives(format['type'], format['args'], attach_target) self.assert_no_active_block_jobs() @@ -506,15 +508,16 @@ class TestDriveCompression(iotests.QMPTestCase): def test_compress_cancel_drive_backup(self): for format in TestDriveCompression.fmt_supports_compression: - self.do_test_compress_cancel('drive-backup', format, + self.do_test_compress_cancel('drive-backup', format, False, target=blockdev_target_img, mode='existing') def test_compress_cancel_blockdev_backup(self): for format in TestDriveCompression.fmt_supports_compression: - self.do_test_compress_cancel('blockdev-backup', format, target='drive1') + self.do_test_compress_cancel('blockdev-backup', format, True, + target='drive1') - def do_test_compress_pause(self, cmd, format, **args): - self.do_prepare_drives(format['type'], format['args']) + def do_test_compress_pause(self, cmd, format, attach_target, **args): + self.do_prepare_drives(format['type'], format['args'], attach_target) self.assert_no_active_block_jobs() @@ -546,12 +549,13 @@ class TestDriveCompression(iotests.QMPTestCase): def test_compress_pause_drive_backup(self): for format in TestDriveCompression.fmt_supports_compression: - self.do_test_compress_pause('drive-backup', format, + self.do_test_compress_pause('drive-backup', format, False, target=blockdev_target_img, mode='existing') def test_compress_pause_blockdev_backup(self): for format in TestDriveCompression.fmt_supports_compression: - self.do_test_compress_pause('blockdev-backup', format, target='drive1') + self.do_test_compress_pause('blockdev-backup', format, True, + target='drive1') if __name__ == '__main__': iotests.main(supported_fmts=['raw', 'qcow2']) |