summaryrefslogtreecommitdiffstats
path: root/tests/qemu-iotests/041
diff options
context:
space:
mode:
authorPaolo Bonzini2013-01-22 09:03:13 +0100
committerKevin Wolf2013-01-25 18:18:34 +0100
commit08e4ed6cdeeee7912072cf14aa8ab6c60dacb4fb (patch)
tree476d2229546a51ab953db9d1622ae7ffa72f82f1 /tests/qemu-iotests/041
parentmirror: switch mirror_iteration to AIO (diff)
downloadqemu-08e4ed6cdeeee7912072cf14aa8ab6c60dacb4fb.tar.gz
qemu-08e4ed6cdeeee7912072cf14aa8ab6c60dacb4fb.tar.xz
qemu-08e4ed6cdeeee7912072cf14aa8ab6c60dacb4fb.zip
mirror: add buf-size argument to drive-mirror
This makes sense when the next commit starts using the extra buffer space to perform many I/O operations asynchronously. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'tests/qemu-iotests/041')
-rwxr-xr-xtests/qemu-iotests/04131
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/qemu-iotests/041 b/tests/qemu-iotests/041
index a1299b348e..b040820c51 100755
--- a/tests/qemu-iotests/041
+++ b/tests/qemu-iotests/041
@@ -207,6 +207,37 @@ class TestSingleDrive(ImageMirroringTestCase):
self.assertTrue(self.compare_images(test_img, target_img),
'target image does not match source after mirroring')
+ def test_small_buffer(self):
+ self.assert_no_active_mirrors()
+
+ # A small buffer is rounded up automatically
+ result = self.vm.qmp('drive-mirror', device='drive0', sync='full',
+ buf_size=4096, target=target_img)
+ self.assert_qmp(result, 'return', {})
+
+ self.complete_and_wait()
+ result = self.vm.qmp('query-block')
+ self.assert_qmp(result, 'return[0]/inserted/file', target_img)
+ self.vm.shutdown()
+ self.assertTrue(self.compare_images(test_img, target_img),
+ 'target image does not match source after mirroring')
+
+ def test_small_buffer2(self):
+ self.assert_no_active_mirrors()
+
+ qemu_img('create', '-f', iotests.imgfmt, '-o', 'cluster_size=%d,size=%d'
+ % (TestSingleDrive.image_len, TestSingleDrive.image_len), target_img)
+ result = self.vm.qmp('drive-mirror', device='drive0', sync='full',
+ buf_size=65536, mode='existing', target=target_img)
+ self.assert_qmp(result, 'return', {})
+
+ self.complete_and_wait()
+ result = self.vm.qmp('query-block')
+ self.assert_qmp(result, 'return[0]/inserted/file', target_img)
+ self.vm.shutdown()
+ self.assertTrue(self.compare_images(test_img, target_img),
+ 'target image does not match source after mirroring')
+
def test_large_cluster(self):
self.assert_no_active_mirrors()