thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

Blame SOURCES/kvm-qemu-iotests-Extend-041-for-unbacked-mirroring.patch

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