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