|
|
0a122b |
From dc76b8c7582d037b1b150f9d809deb05d1a31b05 Mon Sep 17 00:00:00 2001
|
|
|
0a122b |
From: Max Reitz <mreitz@redhat.com>
|
|
|
0a122b |
Date: Sun, 19 Jan 2014 18:07:56 +0100
|
|
|
0a122b |
Subject: [PATCH 22/34] qemu-iotests: make assert_no_active_block_jobs() common
|
|
|
0a122b |
|
|
|
0a122b |
RH-Author: Max Reitz <mreitz@redhat.com>
|
|
|
0a122b |
Message-id: <1390154881-17140-3-git-send-email-mreitz@redhat.com>
|
|
|
0a122b |
Patchwork-id: 56815
|
|
|
0a122b |
O-Subject: [RHEL-7.0 qemu-kvm PATCH v2 2/7] qemu-iotests: make assert_no_active_block_jobs() common
|
|
|
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 |
From: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
0a122b |
|
|
|
0a122b |
BZ: 921890
|
|
|
0a122b |
|
|
|
0a122b |
Tests 030 and 041 both use query-block-jobs to check whether any block
|
|
|
0a122b |
jobs are active. Make this code common so that 'drive-backup' and other
|
|
|
0a122b |
new feature tests will be able to reuse it.
|
|
|
0a122b |
|
|
|
0a122b |
Suggested-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
0a122b |
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
0a122b |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
0a122b |
(cherry picked from commit ecc1c88efddb376687084c3387c38b3a458c5892)
|
|
|
0a122b |
|
|
|
0a122b |
Signed-off-by: Max Reitz <mreitz@redhat.com>
|
|
|
0a122b |
---
|
|
|
0a122b |
tests/qemu-iotests/030 | 54 ++++++++++++++++++--------------------
|
|
|
0a122b |
tests/qemu-iotests/041 | 60 ++++++++++++++++++++-----------------------
|
|
|
0a122b |
tests/qemu-iotests/iotests.py | 4 +++
|
|
|
0a122b |
3 files changed, 57 insertions(+), 61 deletions(-)
|
|
|
0a122b |
|
|
|
0a122b |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
0a122b |
---
|
|
|
0a122b |
tests/qemu-iotests/030 | 54 +++++++++++++++++-------------------
|
|
|
0a122b |
tests/qemu-iotests/041 | 60 +++++++++++++++++++----------------------
|
|
|
0a122b |
tests/qemu-iotests/iotests.py | 4 +++
|
|
|
0a122b |
3 files changed, 57 insertions(+), 61 deletions(-)
|
|
|
0a122b |
|
|
|
0a122b |
diff --git a/tests/qemu-iotests/030 b/tests/qemu-iotests/030
|
|
|
0a122b |
index 3d128b3..9cf256b 100755
|
|
|
0a122b |
--- a/tests/qemu-iotests/030
|
|
|
0a122b |
+++ b/tests/qemu-iotests/030
|
|
|
0a122b |
@@ -31,10 +31,6 @@ test_img = os.path.join(iotests.test_dir, 'test.img')
|
|
|
0a122b |
class ImageStreamingTestCase(iotests.QMPTestCase):
|
|
|
0a122b |
'''Abstract base class for image streaming test cases'''
|
|
|
0a122b |
|
|
|
0a122b |
- def assert_no_active_streams(self):
|
|
|
0a122b |
- result = self.vm.qmp('query-block-jobs')
|
|
|
0a122b |
- self.assert_qmp(result, 'return', [])
|
|
|
0a122b |
-
|
|
|
0a122b |
def cancel_and_wait(self, drive='drive0'):
|
|
|
0a122b |
'''Cancel a block job and wait for it to finish'''
|
|
|
0a122b |
result = self.vm.qmp('block-job-cancel', device=drive)
|
|
|
0a122b |
@@ -48,7 +44,7 @@ class ImageStreamingTestCase(iotests.QMPTestCase):
|
|
|
0a122b |
self.assert_qmp(event, 'data/device', drive)
|
|
|
0a122b |
cancelled = True
|
|
|
0a122b |
|
|
|
0a122b |
- self.assert_no_active_streams()
|
|
|
0a122b |
+ self.assert_no_active_block_jobs()
|
|
|
0a122b |
|
|
|
0a122b |
def create_image(self, name, size):
|
|
|
0a122b |
file = open(name, 'w')
|
|
|
0a122b |
@@ -77,7 +73,7 @@ class TestSingleDrive(ImageStreamingTestCase):
|
|
|
0a122b |
os.remove(backing_img)
|
|
|
0a122b |
|
|
|
0a122b |
def test_stream(self):
|
|
|
0a122b |
- self.assert_no_active_streams()
|
|
|
0a122b |
+ self.assert_no_active_block_jobs()
|
|
|
0a122b |
|
|
|
0a122b |
result = self.vm.qmp('block-stream', device='drive0')
|
|
|
0a122b |
self.assert_qmp(result, 'return', {})
|
|
|
0a122b |
@@ -92,7 +88,7 @@ class TestSingleDrive(ImageStreamingTestCase):
|
|
|
0a122b |
self.assert_qmp(event, 'data/len', self.image_len)
|
|
|
0a122b |
completed = True
|
|
|
0a122b |
|
|
|
0a122b |
- self.assert_no_active_streams()
|
|
|
0a122b |
+ self.assert_no_active_block_jobs()
|
|
|
0a122b |
self.vm.shutdown()
|
|
|
0a122b |
|
|
|
0a122b |
self.assertEqual(qemu_io('-c', 'map', backing_img),
|
|
|
0a122b |
@@ -100,7 +96,7 @@ class TestSingleDrive(ImageStreamingTestCase):
|
|
|
0a122b |
'image file map does not match backing file after streaming')
|
|
|
0a122b |
|
|
|
0a122b |
def test_stream_pause(self):
|
|
|
0a122b |
- self.assert_no_active_streams()
|
|
|
0a122b |
+ self.assert_no_active_block_jobs()
|
|
|
0a122b |
|
|
|
0a122b |
result = self.vm.qmp('block-stream', device='drive0')
|
|
|
0a122b |
self.assert_qmp(result, 'return', {})
|
|
|
0a122b |
@@ -129,7 +125,7 @@ class TestSingleDrive(ImageStreamingTestCase):
|
|
|
0a122b |
self.assert_qmp(event, 'data/len', self.image_len)
|
|
|
0a122b |
completed = True
|
|
|
0a122b |
|
|
|
0a122b |
- self.assert_no_active_streams()
|
|
|
0a122b |
+ self.assert_no_active_block_jobs()
|
|
|
0a122b |
self.vm.shutdown()
|
|
|
0a122b |
|
|
|
0a122b |
self.assertEqual(qemu_io('-c', 'map', backing_img),
|
|
|
0a122b |
@@ -137,7 +133,7 @@ class TestSingleDrive(ImageStreamingTestCase):
|
|
|
0a122b |
'image file map does not match backing file after streaming')
|
|
|
0a122b |
|
|
|
0a122b |
def test_stream_partial(self):
|
|
|
0a122b |
- self.assert_no_active_streams()
|
|
|
0a122b |
+ self.assert_no_active_block_jobs()
|
|
|
0a122b |
|
|
|
0a122b |
result = self.vm.qmp('block-stream', device='drive0', base=mid_img)
|
|
|
0a122b |
self.assert_qmp(result, 'return', {})
|
|
|
0a122b |
@@ -152,7 +148,7 @@ class TestSingleDrive(ImageStreamingTestCase):
|
|
|
0a122b |
self.assert_qmp(event, 'data/len', self.image_len)
|
|
|
0a122b |
completed = True
|
|
|
0a122b |
|
|
|
0a122b |
- self.assert_no_active_streams()
|
|
|
0a122b |
+ self.assert_no_active_block_jobs()
|
|
|
0a122b |
self.vm.shutdown()
|
|
|
0a122b |
|
|
|
0a122b |
self.assertEqual(qemu_io('-c', 'map', mid_img),
|
|
|
0a122b |
@@ -177,7 +173,7 @@ class TestSmallerBackingFile(ImageStreamingTestCase):
|
|
|
0a122b |
# If this hangs, then you are missing a fix to complete streaming when the
|
|
|
0a122b |
# end of the backing file is reached.
|
|
|
0a122b |
def test_stream(self):
|
|
|
0a122b |
- self.assert_no_active_streams()
|
|
|
0a122b |
+ self.assert_no_active_block_jobs()
|
|
|
0a122b |
|
|
|
0a122b |
result = self.vm.qmp('block-stream', device='drive0')
|
|
|
0a122b |
self.assert_qmp(result, 'return', {})
|
|
|
0a122b |
@@ -192,7 +188,7 @@ class TestSmallerBackingFile(ImageStreamingTestCase):
|
|
|
0a122b |
self.assert_qmp(event, 'data/len', self.image_len)
|
|
|
0a122b |
completed = True
|
|
|
0a122b |
|
|
|
0a122b |
- self.assert_no_active_streams()
|
|
|
0a122b |
+ self.assert_no_active_block_jobs()
|
|
|
0a122b |
self.vm.shutdown()
|
|
|
0a122b |
|
|
|
0a122b |
class TestErrors(ImageStreamingTestCase):
|
|
|
0a122b |
@@ -243,7 +239,7 @@ class TestEIO(TestErrors):
|
|
|
0a122b |
os.remove(self.blkdebug_file)
|
|
|
0a122b |
|
|
|
0a122b |
def test_report(self):
|
|
|
0a122b |
- self.assert_no_active_streams()
|
|
|
0a122b |
+ self.assert_no_active_block_jobs()
|
|
|
0a122b |
|
|
|
0a122b |
result = self.vm.qmp('block-stream', device='drive0')
|
|
|
0a122b |
self.assert_qmp(result, 'return', {})
|
|
|
0a122b |
@@ -265,11 +261,11 @@ class TestEIO(TestErrors):
|
|
|
0a122b |
self.assert_qmp(event, 'data/len', self.image_len)
|
|
|
0a122b |
completed = True
|
|
|
0a122b |
|
|
|
0a122b |
- self.assert_no_active_streams()
|
|
|
0a122b |
+ self.assert_no_active_block_jobs()
|
|
|
0a122b |
self.vm.shutdown()
|
|
|
0a122b |
|
|
|
0a122b |
def test_ignore(self):
|
|
|
0a122b |
- self.assert_no_active_streams()
|
|
|
0a122b |
+ self.assert_no_active_block_jobs()
|
|
|
0a122b |
|
|
|
0a122b |
result = self.vm.qmp('block-stream', device='drive0', on_error='ignore')
|
|
|
0a122b |
self.assert_qmp(result, 'return', {})
|
|
|
0a122b |
@@ -293,11 +289,11 @@ class TestEIO(TestErrors):
|
|
|
0a122b |
self.assert_qmp(event, 'data/len', self.image_len)
|
|
|
0a122b |
completed = True
|
|
|
0a122b |
|
|
|
0a122b |
- self.assert_no_active_streams()
|
|
|
0a122b |
+ self.assert_no_active_block_jobs()
|
|
|
0a122b |
self.vm.shutdown()
|
|
|
0a122b |
|
|
|
0a122b |
def test_stop(self):
|
|
|
0a122b |
- self.assert_no_active_streams()
|
|
|
0a122b |
+ self.assert_no_active_block_jobs()
|
|
|
0a122b |
|
|
|
0a122b |
result = self.vm.qmp('block-stream', device='drive0', on_error='stop')
|
|
|
0a122b |
self.assert_qmp(result, 'return', {})
|
|
|
0a122b |
@@ -331,11 +327,11 @@ class TestEIO(TestErrors):
|
|
|
0a122b |
self.assert_qmp(event, 'data/len', self.image_len)
|
|
|
0a122b |
completed = True
|
|
|
0a122b |
|
|
|
0a122b |
- self.assert_no_active_streams()
|
|
|
0a122b |
+ self.assert_no_active_block_jobs()
|
|
|
0a122b |
self.vm.shutdown()
|
|
|
0a122b |
|
|
|
0a122b |
def test_enospc(self):
|
|
|
0a122b |
- self.assert_no_active_streams()
|
|
|
0a122b |
+ self.assert_no_active_block_jobs()
|
|
|
0a122b |
|
|
|
0a122b |
result = self.vm.qmp('block-stream', device='drive0', on_error='enospc')
|
|
|
0a122b |
self.assert_qmp(result, 'return', {})
|
|
|
0a122b |
@@ -357,7 +353,7 @@ class TestEIO(TestErrors):
|
|
|
0a122b |
self.assert_qmp(event, 'data/len', self.image_len)
|
|
|
0a122b |
completed = True
|
|
|
0a122b |
|
|
|
0a122b |
- self.assert_no_active_streams()
|
|
|
0a122b |
+ self.assert_no_active_block_jobs()
|
|
|
0a122b |
self.vm.shutdown()
|
|
|
0a122b |
|
|
|
0a122b |
class TestENOSPC(TestErrors):
|
|
|
0a122b |
@@ -379,7 +375,7 @@ class TestENOSPC(TestErrors):
|
|
|
0a122b |
os.remove(self.blkdebug_file)
|
|
|
0a122b |
|
|
|
0a122b |
def test_enospc(self):
|
|
|
0a122b |
- self.assert_no_active_streams()
|
|
|
0a122b |
+ self.assert_no_active_block_jobs()
|
|
|
0a122b |
|
|
|
0a122b |
result = self.vm.qmp('block-stream', device='drive0', on_error='enospc')
|
|
|
0a122b |
self.assert_qmp(result, 'return', {})
|
|
|
0a122b |
@@ -413,7 +409,7 @@ class TestENOSPC(TestErrors):
|
|
|
0a122b |
self.assert_qmp(event, 'data/len', self.image_len)
|
|
|
0a122b |
completed = True
|
|
|
0a122b |
|
|
|
0a122b |
- self.assert_no_active_streams()
|
|
|
0a122b |
+ self.assert_no_active_block_jobs()
|
|
|
0a122b |
self.vm.shutdown()
|
|
|
0a122b |
|
|
|
0a122b |
class TestStreamStop(ImageStreamingTestCase):
|
|
|
0a122b |
@@ -433,7 +429,7 @@ class TestStreamStop(ImageStreamingTestCase):
|
|
|
0a122b |
os.remove(backing_img)
|
|
|
0a122b |
|
|
|
0a122b |
def test_stream_stop(self):
|
|
|
0a122b |
- self.assert_no_active_streams()
|
|
|
0a122b |
+ self.assert_no_active_block_jobs()
|
|
|
0a122b |
|
|
|
0a122b |
result = self.vm.qmp('block-stream', device='drive0')
|
|
|
0a122b |
self.assert_qmp(result, 'return', {})
|
|
|
0a122b |
@@ -463,7 +459,7 @@ class TestSetSpeed(ImageStreamingTestCase):
|
|
|
0a122b |
# This is a short performance test which is not run by default.
|
|
|
0a122b |
# Invoke "IMGFMT=qed ./030 TestSetSpeed.perf_test_throughput"
|
|
|
0a122b |
def perf_test_throughput(self):
|
|
|
0a122b |
- self.assert_no_active_streams()
|
|
|
0a122b |
+ self.assert_no_active_block_jobs()
|
|
|
0a122b |
|
|
|
0a122b |
result = self.vm.qmp('block-stream', device='drive0')
|
|
|
0a122b |
self.assert_qmp(result, 'return', {})
|
|
|
0a122b |
@@ -481,10 +477,10 @@ class TestSetSpeed(ImageStreamingTestCase):
|
|
|
0a122b |
self.assert_qmp(event, 'data/len', self.image_len)
|
|
|
0a122b |
completed = True
|
|
|
0a122b |
|
|
|
0a122b |
- self.assert_no_active_streams()
|
|
|
0a122b |
+ self.assert_no_active_block_jobs()
|
|
|
0a122b |
|
|
|
0a122b |
def test_set_speed(self):
|
|
|
0a122b |
- self.assert_no_active_streams()
|
|
|
0a122b |
+ self.assert_no_active_block_jobs()
|
|
|
0a122b |
|
|
|
0a122b |
result = self.vm.qmp('block-stream', device='drive0')
|
|
|
0a122b |
self.assert_qmp(result, 'return', {})
|
|
|
0a122b |
@@ -515,12 +511,12 @@ class TestSetSpeed(ImageStreamingTestCase):
|
|
|
0a122b |
self.cancel_and_wait()
|
|
|
0a122b |
|
|
|
0a122b |
def test_set_speed_invalid(self):
|
|
|
0a122b |
- self.assert_no_active_streams()
|
|
|
0a122b |
+ self.assert_no_active_block_jobs()
|
|
|
0a122b |
|
|
|
0a122b |
result = self.vm.qmp('block-stream', device='drive0', speed=-1)
|
|
|
0a122b |
self.assert_qmp(result, 'error/class', 'GenericError')
|
|
|
0a122b |
|
|
|
0a122b |
- self.assert_no_active_streams()
|
|
|
0a122b |
+ self.assert_no_active_block_jobs()
|
|
|
0a122b |
|
|
|
0a122b |
result = self.vm.qmp('block-stream', device='drive0')
|
|
|
0a122b |
self.assert_qmp(result, 'return', {})
|
|
|
0a122b |
diff --git a/tests/qemu-iotests/041 b/tests/qemu-iotests/041
|
|
|
0a122b |
index 720eeff..ff89427 100755
|
|
|
0a122b |
--- a/tests/qemu-iotests/041
|
|
|
0a122b |
+++ b/tests/qemu-iotests/041
|
|
|
0a122b |
@@ -32,10 +32,6 @@ target_img = os.path.join(iotests.test_dir, 'target.img')
|
|
|
0a122b |
class ImageMirroringTestCase(iotests.QMPTestCase):
|
|
|
0a122b |
'''Abstract base class for image mirroring test cases'''
|
|
|
0a122b |
|
|
|
0a122b |
- def assert_no_active_mirrors(self):
|
|
|
0a122b |
- result = self.vm.qmp('query-block-jobs')
|
|
|
0a122b |
- self.assert_qmp(result, 'return', [])
|
|
|
0a122b |
-
|
|
|
0a122b |
def cancel_and_wait(self, drive='drive0', wait_ready=True):
|
|
|
0a122b |
'''Cancel a block job and wait for it to finish'''
|
|
|
0a122b |
if wait_ready:
|
|
|
0a122b |
@@ -64,7 +60,7 @@ class ImageMirroringTestCase(iotests.QMPTestCase):
|
|
|
0a122b |
self.assert_qmp(event, 'data/len', self.image_len)
|
|
|
0a122b |
cancelled = True
|
|
|
0a122b |
|
|
|
0a122b |
- self.assert_no_active_mirrors()
|
|
|
0a122b |
+ self.assert_no_active_block_jobs()
|
|
|
0a122b |
|
|
|
0a122b |
def complete_and_wait(self, drive='drive0', wait_ready=True):
|
|
|
0a122b |
'''Complete a block job and wait for it to finish'''
|
|
|
0a122b |
@@ -91,7 +87,7 @@ class ImageMirroringTestCase(iotests.QMPTestCase):
|
|
|
0a122b |
self.assert_qmp(event, 'data/len', self.image_len)
|
|
|
0a122b |
completed = True
|
|
|
0a122b |
|
|
|
0a122b |
- self.assert_no_active_mirrors()
|
|
|
0a122b |
+ self.assert_no_active_block_jobs()
|
|
|
0a122b |
|
|
|
0a122b |
def create_image(self, name, size):
|
|
|
0a122b |
file = open(name, 'w')
|
|
|
0a122b |
@@ -142,7 +138,7 @@ class TestSingleDrive(ImageMirroringTestCase):
|
|
|
0a122b |
pass
|
|
|
0a122b |
|
|
|
0a122b |
def test_complete(self):
|
|
|
0a122b |
- self.assert_no_active_mirrors()
|
|
|
0a122b |
+ self.assert_no_active_block_jobs()
|
|
|
0a122b |
|
|
|
0a122b |
result = self.vm.qmp('drive-mirror', device='drive0', sync='full',
|
|
|
0a122b |
target=target_img)
|
|
|
0a122b |
@@ -156,7 +152,7 @@ class TestSingleDrive(ImageMirroringTestCase):
|
|
|
0a122b |
'target image does not match source after mirroring')
|
|
|
0a122b |
|
|
|
0a122b |
def test_cancel(self):
|
|
|
0a122b |
- self.assert_no_active_mirrors()
|
|
|
0a122b |
+ self.assert_no_active_block_jobs()
|
|
|
0a122b |
|
|
|
0a122b |
result = self.vm.qmp('drive-mirror', device='drive0', sync='full',
|
|
|
0a122b |
target=target_img)
|
|
|
0a122b |
@@ -168,7 +164,7 @@ class TestSingleDrive(ImageMirroringTestCase):
|
|
|
0a122b |
self.vm.shutdown()
|
|
|
0a122b |
|
|
|
0a122b |
def test_cancel_after_ready(self):
|
|
|
0a122b |
- self.assert_no_active_mirrors()
|
|
|
0a122b |
+ self.assert_no_active_block_jobs()
|
|
|
0a122b |
|
|
|
0a122b |
result = self.vm.qmp('drive-mirror', device='drive0', sync='full',
|
|
|
0a122b |
target=target_img)
|
|
|
0a122b |
@@ -182,7 +178,7 @@ class TestSingleDrive(ImageMirroringTestCase):
|
|
|
0a122b |
'target image does not match source after mirroring')
|
|
|
0a122b |
|
|
|
0a122b |
def test_pause(self):
|
|
|
0a122b |
- self.assert_no_active_mirrors()
|
|
|
0a122b |
+ self.assert_no_active_block_jobs()
|
|
|
0a122b |
|
|
|
0a122b |
result = self.vm.qmp('drive-mirror', device='drive0', sync='full',
|
|
|
0a122b |
target=target_img)
|
|
|
0a122b |
@@ -208,7 +204,7 @@ class TestSingleDrive(ImageMirroringTestCase):
|
|
|
0a122b |
'target image does not match source after mirroring')
|
|
|
0a122b |
|
|
|
0a122b |
def test_small_buffer(self):
|
|
|
0a122b |
- self.assert_no_active_mirrors()
|
|
|
0a122b |
+ self.assert_no_active_block_jobs()
|
|
|
0a122b |
|
|
|
0a122b |
# A small buffer is rounded up automatically
|
|
|
0a122b |
result = self.vm.qmp('drive-mirror', device='drive0', sync='full',
|
|
|
0a122b |
@@ -223,7 +219,7 @@ class TestSingleDrive(ImageMirroringTestCase):
|
|
|
0a122b |
'target image does not match source after mirroring')
|
|
|
0a122b |
|
|
|
0a122b |
def test_small_buffer2(self):
|
|
|
0a122b |
- self.assert_no_active_mirrors()
|
|
|
0a122b |
+ self.assert_no_active_block_jobs()
|
|
|
0a122b |
|
|
|
0a122b |
qemu_img('create', '-f', iotests.imgfmt, '-o', 'cluster_size=%d,size=%d'
|
|
|
0a122b |
% (TestSingleDrive.image_len, TestSingleDrive.image_len), target_img)
|
|
|
0a122b |
@@ -239,7 +235,7 @@ class TestSingleDrive(ImageMirroringTestCase):
|
|
|
0a122b |
'target image does not match source after mirroring')
|
|
|
0a122b |
|
|
|
0a122b |
def test_large_cluster(self):
|
|
|
0a122b |
- self.assert_no_active_mirrors()
|
|
|
0a122b |
+ self.assert_no_active_block_jobs()
|
|
|
0a122b |
|
|
|
0a122b |
qemu_img('create', '-f', iotests.imgfmt, '-o', 'cluster_size=%d,backing_file=%s'
|
|
|
0a122b |
% (TestSingleDrive.image_len, backing_img), target_img)
|
|
|
0a122b |
@@ -294,7 +290,7 @@ class TestMirrorNoBacking(ImageMirroringTestCase):
|
|
|
0a122b |
os.remove(target_img)
|
|
|
0a122b |
|
|
|
0a122b |
def test_complete(self):
|
|
|
0a122b |
- self.assert_no_active_mirrors()
|
|
|
0a122b |
+ self.assert_no_active_block_jobs()
|
|
|
0a122b |
|
|
|
0a122b |
qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=%s' % backing_img, target_img)
|
|
|
0a122b |
result = self.vm.qmp('drive-mirror', device='drive0', sync='full',
|
|
|
0a122b |
@@ -309,7 +305,7 @@ class TestMirrorNoBacking(ImageMirroringTestCase):
|
|
|
0a122b |
'target image does not match source after mirroring')
|
|
|
0a122b |
|
|
|
0a122b |
def test_cancel(self):
|
|
|
0a122b |
- self.assert_no_active_mirrors()
|
|
|
0a122b |
+ self.assert_no_active_block_jobs()
|
|
|
0a122b |
|
|
|
0a122b |
qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=%s' % backing_img, target_img)
|
|
|
0a122b |
result = self.vm.qmp('drive-mirror', device='drive0', sync='full',
|
|
|
0a122b |
@@ -324,7 +320,7 @@ class TestMirrorNoBacking(ImageMirroringTestCase):
|
|
|
0a122b |
'target image does not match source after mirroring')
|
|
|
0a122b |
|
|
|
0a122b |
def test_large_cluster(self):
|
|
|
0a122b |
- self.assert_no_active_mirrors()
|
|
|
0a122b |
+ self.assert_no_active_block_jobs()
|
|
|
0a122b |
|
|
|
0a122b |
# qemu-img create fails if the image is not there
|
|
|
0a122b |
qemu_img('create', '-f', iotests.imgfmt, '-o', 'size=%d'
|
|
|
0a122b |
@@ -365,7 +361,7 @@ class TestMirrorResized(ImageMirroringTestCase):
|
|
|
0a122b |
pass
|
|
|
0a122b |
|
|
|
0a122b |
def test_complete_top(self):
|
|
|
0a122b |
- self.assert_no_active_mirrors()
|
|
|
0a122b |
+ self.assert_no_active_block_jobs()
|
|
|
0a122b |
|
|
|
0a122b |
result = self.vm.qmp('drive-mirror', device='drive0', sync='top',
|
|
|
0a122b |
target=target_img)
|
|
|
0a122b |
@@ -379,7 +375,7 @@ class TestMirrorResized(ImageMirroringTestCase):
|
|
|
0a122b |
'target image does not match source after mirroring')
|
|
|
0a122b |
|
|
|
0a122b |
def test_complete_full(self):
|
|
|
0a122b |
- self.assert_no_active_mirrors()
|
|
|
0a122b |
+ self.assert_no_active_block_jobs()
|
|
|
0a122b |
|
|
|
0a122b |
result = self.vm.qmp('drive-mirror', device='drive0', sync='full',
|
|
|
0a122b |
target=target_img)
|
|
|
0a122b |
@@ -443,7 +439,7 @@ new_state = "1"
|
|
|
0a122b |
os.remove(self.blkdebug_file)
|
|
|
0a122b |
|
|
|
0a122b |
def test_report_read(self):
|
|
|
0a122b |
- self.assert_no_active_mirrors()
|
|
|
0a122b |
+ self.assert_no_active_block_jobs()
|
|
|
0a122b |
|
|
|
0a122b |
result = self.vm.qmp('drive-mirror', device='drive0', sync='full',
|
|
|
0a122b |
target=target_img)
|
|
|
0a122b |
@@ -467,11 +463,11 @@ new_state = "1"
|
|
|
0a122b |
self.assert_qmp(event, 'data/len', self.image_len)
|
|
|
0a122b |
completed = True
|
|
|
0a122b |
|
|
|
0a122b |
- self.assert_no_active_mirrors()
|
|
|
0a122b |
+ self.assert_no_active_block_jobs()
|
|
|
0a122b |
self.vm.shutdown()
|
|
|
0a122b |
|
|
|
0a122b |
def test_ignore_read(self):
|
|
|
0a122b |
- self.assert_no_active_mirrors()
|
|
|
0a122b |
+ self.assert_no_active_block_jobs()
|
|
|
0a122b |
|
|
|
0a122b |
result = self.vm.qmp('drive-mirror', device='drive0', sync='full',
|
|
|
0a122b |
target=target_img, on_source_error='ignore')
|
|
|
0a122b |
@@ -487,7 +483,7 @@ new_state = "1"
|
|
|
0a122b |
self.vm.shutdown()
|
|
|
0a122b |
|
|
|
0a122b |
def test_large_cluster(self):
|
|
|
0a122b |
- self.assert_no_active_mirrors()
|
|
|
0a122b |
+ self.assert_no_active_block_jobs()
|
|
|
0a122b |
|
|
|
0a122b |
# Test COW into the target image. The first half of the
|
|
|
0a122b |
# cluster at MIRROR_GRANULARITY has to be copied from
|
|
|
0a122b |
@@ -513,7 +509,7 @@ new_state = "1"
|
|
|
0a122b |
'target image does not match source after mirroring')
|
|
|
0a122b |
|
|
|
0a122b |
def test_stop_read(self):
|
|
|
0a122b |
- self.assert_no_active_mirrors()
|
|
|
0a122b |
+ self.assert_no_active_block_jobs()
|
|
|
0a122b |
|
|
|
0a122b |
result = self.vm.qmp('drive-mirror', device='drive0', sync='full',
|
|
|
0a122b |
target=target_img, on_source_error='stop')
|
|
|
0a122b |
@@ -544,7 +540,7 @@ new_state = "1"
|
|
|
0a122b |
self.assert_qmp(result, 'return[0]/io-status', 'ok')
|
|
|
0a122b |
|
|
|
0a122b |
self.complete_and_wait(wait_ready=False)
|
|
|
0a122b |
- self.assert_no_active_mirrors()
|
|
|
0a122b |
+ self.assert_no_active_block_jobs()
|
|
|
0a122b |
self.vm.shutdown()
|
|
|
0a122b |
|
|
|
0a122b |
class TestWriteErrors(ImageMirroringTestCase):
|
|
|
0a122b |
@@ -594,7 +590,7 @@ new_state = "1"
|
|
|
0a122b |
os.remove(self.blkdebug_file)
|
|
|
0a122b |
|
|
|
0a122b |
def test_report_write(self):
|
|
|
0a122b |
- self.assert_no_active_mirrors()
|
|
|
0a122b |
+ self.assert_no_active_block_jobs()
|
|
|
0a122b |
|
|
|
0a122b |
result = self.vm.qmp('drive-mirror', device='drive0', sync='full',
|
|
|
0a122b |
mode='existing', target=self.target_img)
|
|
|
0a122b |
@@ -618,11 +614,11 @@ new_state = "1"
|
|
|
0a122b |
self.assert_qmp(event, 'data/len', self.image_len)
|
|
|
0a122b |
completed = True
|
|
|
0a122b |
|
|
|
0a122b |
- self.assert_no_active_mirrors()
|
|
|
0a122b |
+ self.assert_no_active_block_jobs()
|
|
|
0a122b |
self.vm.shutdown()
|
|
|
0a122b |
|
|
|
0a122b |
def test_ignore_write(self):
|
|
|
0a122b |
- self.assert_no_active_mirrors()
|
|
|
0a122b |
+ self.assert_no_active_block_jobs()
|
|
|
0a122b |
|
|
|
0a122b |
result = self.vm.qmp('drive-mirror', device='drive0', sync='full',
|
|
|
0a122b |
mode='existing', target=self.target_img,
|
|
|
0a122b |
@@ -639,7 +635,7 @@ new_state = "1"
|
|
|
0a122b |
self.vm.shutdown()
|
|
|
0a122b |
|
|
|
0a122b |
def test_stop_write(self):
|
|
|
0a122b |
- self.assert_no_active_mirrors()
|
|
|
0a122b |
+ self.assert_no_active_block_jobs()
|
|
|
0a122b |
|
|
|
0a122b |
result = self.vm.qmp('drive-mirror', device='drive0', sync='full',
|
|
|
0a122b |
mode='existing', target=self.target_img,
|
|
|
0a122b |
@@ -671,7 +667,7 @@ new_state = "1"
|
|
|
0a122b |
ready = True
|
|
|
0a122b |
|
|
|
0a122b |
self.complete_and_wait(wait_ready=False)
|
|
|
0a122b |
- self.assert_no_active_mirrors()
|
|
|
0a122b |
+ self.assert_no_active_block_jobs()
|
|
|
0a122b |
self.vm.shutdown()
|
|
|
0a122b |
|
|
|
0a122b |
class TestSetSpeed(ImageMirroringTestCase):
|
|
|
0a122b |
@@ -690,7 +686,7 @@ class TestSetSpeed(ImageMirroringTestCase):
|
|
|
0a122b |
os.remove(target_img)
|
|
|
0a122b |
|
|
|
0a122b |
def test_set_speed(self):
|
|
|
0a122b |
- self.assert_no_active_mirrors()
|
|
|
0a122b |
+ self.assert_no_active_block_jobs()
|
|
|
0a122b |
|
|
|
0a122b |
result = self.vm.qmp('drive-mirror', device='drive0', sync='full',
|
|
|
0a122b |
target=target_img)
|
|
|
0a122b |
@@ -723,13 +719,13 @@ class TestSetSpeed(ImageMirroringTestCase):
|
|
|
0a122b |
self.cancel_and_wait()
|
|
|
0a122b |
|
|
|
0a122b |
def test_set_speed_invalid(self):
|
|
|
0a122b |
- self.assert_no_active_mirrors()
|
|
|
0a122b |
+ self.assert_no_active_block_jobs()
|
|
|
0a122b |
|
|
|
0a122b |
result = self.vm.qmp('drive-mirror', device='drive0', sync='full',
|
|
|
0a122b |
target=target_img, speed=-1)
|
|
|
0a122b |
self.assert_qmp(result, 'error/class', 'GenericError')
|
|
|
0a122b |
|
|
|
0a122b |
- self.assert_no_active_mirrors()
|
|
|
0a122b |
+ self.assert_no_active_block_jobs()
|
|
|
0a122b |
|
|
|
0a122b |
result = self.vm.qmp('drive-mirror', device='drive0', sync='full',
|
|
|
0a122b |
target=target_img)
|
|
|
0a122b |
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
|
|
|
0a122b |
index 5cbac82..740464a 100644
|
|
|
0a122b |
--- a/tests/qemu-iotests/iotests.py
|
|
|
0a122b |
+++ b/tests/qemu-iotests/iotests.py
|
|
|
0a122b |
@@ -174,6 +174,10 @@ class QMPTestCase(unittest.TestCase):
|
|
|
0a122b |
result = self.dictpath(d, path)
|
|
|
0a122b |
self.assertEqual(result, value, 'values not equal "%s" and "%s"' % (str(result), str(value)))
|
|
|
0a122b |
|
|
|
0a122b |
+ def assert_no_active_block_jobs(self):
|
|
|
0a122b |
+ result = self.vm.qmp('query-block-jobs')
|
|
|
0a122b |
+ self.assert_qmp(result, 'return', [])
|
|
|
0a122b |
+
|
|
|
0a122b |
def notrun(reason):
|
|
|
0a122b |
'''Skip this test suite'''
|
|
|
0a122b |
# Each test in qemu-iotests has a number ("seq")
|
|
|
0a122b |
--
|
|
|
0a122b |
1.7.1
|
|
|
0a122b |
|