yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
9ae3a8
From 728f93f0bf205f8b4ebbf2c4f0e57ecd63e1ea98 Mon Sep 17 00:00:00 2001
9ae3a8
From: Max Reitz <mreitz@redhat.com>
9ae3a8
Date: Sun, 19 Jan 2014 18:07:58 +0100
9ae3a8
Subject: [PATCH 24/34] qemu-iotests: Extend 041 for unbacked mirroring
9ae3a8
9ae3a8
RH-Author: Max Reitz <mreitz@redhat.com>
9ae3a8
Message-id: <1390154881-17140-5-git-send-email-mreitz@redhat.com>
9ae3a8
Patchwork-id: 56817
9ae3a8
O-Subject: [RHEL-7.0 qemu-kvm PATCH v2 4/7] qemu-iotests: Extend 041 for unbacked mirroring
9ae3a8
Bugzilla: 921890
9ae3a8
RH-Acked-by: Fam Zheng <famz@redhat.com>
9ae3a8
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
9ae3a8
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
9ae3a8
9ae3a8
BZ: 921890
9ae3a8
9ae3a8
Add a new test case in file 041 for mirroring unbacked images in
9ae3a8
"absolute-paths" mode. This should work, if possible, but most
9ae3a8
importantly, qemu should never crash.
9ae3a8
9ae3a8
Signed-off-by: Max Reitz <mreitz@redhat.com>
9ae3a8
Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
9ae3a8
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
9ae3a8
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9ae3a8
(cherry picked from commit c15badee200f9e743e3639cc5e3e7dd62c69332f)
9ae3a8
9ae3a8
Signed-off-by: Max Reitz <mreitz@redhat.com>
9ae3a8
---
9ae3a8
 tests/qemu-iotests/041     | 25 +++++++++++++++++++++++++
9ae3a8
 tests/qemu-iotests/041.out |  4 ++--
9ae3a8
 2 files changed, 27 insertions(+), 2 deletions(-)
9ae3a8
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 tests/qemu-iotests/041     |   25 +++++++++++++++++++++++++
9ae3a8
 tests/qemu-iotests/041.out |    4 ++--
9ae3a8
 2 files changed, 27 insertions(+), 2 deletions(-)
9ae3a8
9ae3a8
diff --git a/tests/qemu-iotests/041 b/tests/qemu-iotests/041
9ae3a8
index ff89427..eccfe38 100755
9ae3a8
--- a/tests/qemu-iotests/041
9ae3a8
+++ b/tests/qemu-iotests/041
9ae3a8
@@ -736,5 +736,30 @@ class TestSetSpeed(ImageMirroringTestCase):
9ae3a8
 
9ae3a8
         self.cancel_and_wait()
9ae3a8
 
9ae3a8
+class TestUnbackedSource(ImageMirroringTestCase):
9ae3a8
+    image_len = 2 * 1024 * 1024 # MB
9ae3a8
+
9ae3a8
+    def setUp(self):
9ae3a8
+        qemu_img('create', '-f', iotests.imgfmt, test_img,
9ae3a8
+                 str(TestUnbackedSource.image_len))
9ae3a8
+        self.vm = iotests.VM().add_drive(test_img)
9ae3a8
+        self.vm.launch()
9ae3a8
+
9ae3a8
+    def tearDown(self):
9ae3a8
+        self.vm.shutdown()
9ae3a8
+        os.remove(test_img)
9ae3a8
+        os.remove(target_img)
9ae3a8
+
9ae3a8
+    def test_absolute_paths(self):
9ae3a8
+        self.assert_no_active_block_jobs()
9ae3a8
+
9ae3a8
+        for sync_mode in ['full', 'top', 'none']:
9ae3a8
+            result = self.vm.qmp('drive-mirror', device='drive0',
9ae3a8
+                                 sync=sync_mode, target=target_img,
9ae3a8
+                                 mode='absolute-paths')
9ae3a8
+            self.assert_qmp(result, 'return', {})
9ae3a8
+            self.complete_and_wait()
9ae3a8
+            self.assert_no_active_block_jobs()
9ae3a8
+
9ae3a8
 if __name__ == '__main__':
9ae3a8
     iotests.main(supported_fmts=['qcow2', 'qed'])
9ae3a8
diff --git a/tests/qemu-iotests/041.out b/tests/qemu-iotests/041.out
9ae3a8
index 42314e9..4fd1c2d 100644
9ae3a8
--- a/tests/qemu-iotests/041.out
9ae3a8
+++ b/tests/qemu-iotests/041.out
9ae3a8
@@ -1,5 +1,5 @@
9ae3a8
-........................
9ae3a8
+.........................
9ae3a8
 ----------------------------------------------------------------------
9ae3a8
-Ran 24 tests
9ae3a8
+Ran 25 tests
9ae3a8
 
9ae3a8
 OK
9ae3a8
-- 
9ae3a8
1.7.1
9ae3a8