[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 74/79] qemu-iotests: Test automatic commit job cance
From: |
Michael Roth |
Subject: |
[Qemu-devel] [PATCH 74/79] qemu-iotests: Test automatic commit job cancel on hot unplug |
Date: |
Mon, 28 Aug 2017 19:14:49 -0500 |
From: Kevin Wolf <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
Reviewed-by: John Snow <address@hidden>
(cherry picked from commit c3971b883a596abc6af45f53d2f43fb2f59ccd3b)
*prereq for d3c8c674
Signed-off-by: Michael Roth <address@hidden>
---
tests/qemu-iotests/040 | 35 +++++++++++++++++++++++++++++++++--
tests/qemu-iotests/040.out | 4 ++--
2 files changed, 35 insertions(+), 4 deletions(-)
diff --git a/tests/qemu-iotests/040 b/tests/qemu-iotests/040
index 5bdaf3d..9d381d9 100755
--- a/tests/qemu-iotests/040
+++ b/tests/qemu-iotests/040
@@ -70,7 +70,9 @@ class ImageCommitTestCase(iotests.QMPTestCase):
self.wait_for_complete()
class TestSingleDrive(ImageCommitTestCase):
- image_len = 1 * 1024 * 1024
+ # Need some space after the copied data so that throttling is effective in
+ # tests that use it rather than just completing the job immediately
+ image_len = 2 * 1024 * 1024
test_len = 1 * 1024 * 256
def setUp(self):
@@ -79,7 +81,9 @@ class TestSingleDrive(ImageCommitTestCase):
qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=%s' %
mid_img, test_img)
qemu_io('-f', 'raw', '-c', 'write -P 0xab 0 524288', backing_img)
qemu_io('-f', iotests.imgfmt, '-c', 'write -P 0xef 524288 524288',
mid_img)
- self.vm = iotests.VM().add_drive(test_img)
+ self.vm = iotests.VM().add_drive(test_img, interface="none")
+ self.vm.add_device("virtio-scsi-pci")
+ self.vm.add_device("scsi-hd,id=scsi0,drive=drive0")
self.vm.launch()
def tearDown(self):
@@ -131,6 +135,33 @@ class TestSingleDrive(ImageCommitTestCase):
self.assert_qmp(result, 'error/class', 'GenericError')
self.assert_qmp(result, 'error/desc', 'Base \'%s\' not found' %
mid_img)
+ # When the job is running on a BB that is automatically deleted on hot
+ # unplug, the job is cancelled when the device disappears
+ def test_hot_unplug(self):
+ if self.image_len == 0:
+ return
+
+ self.assert_no_active_block_jobs()
+ result = self.vm.qmp('block-commit', device='drive0', top=mid_img,
+ base=backing_img, speed=(self.image_len / 4))
+ self.assert_qmp(result, 'return', {})
+ result = self.vm.qmp('device_del', id='scsi0')
+ self.assert_qmp(result, 'return', {})
+
+ cancelled = False
+ deleted = False
+ while not cancelled or not deleted:
+ for event in self.vm.get_qmp_events(wait=True):
+ if event['event'] == 'DEVICE_DELETED':
+ self.assert_qmp(event, 'data/device', 'scsi0')
+ deleted = True
+ elif event['event'] == 'BLOCK_JOB_CANCELLED':
+ self.assert_qmp(event, 'data/device', 'drive0')
+ cancelled = True
+ else:
+ self.fail("Unexpected event %s" % (event['event']))
+
+ self.assert_no_active_block_jobs()
class TestRelativePaths(ImageCommitTestCase):
image_len = 1 * 1024 * 1024
diff --git a/tests/qemu-iotests/040.out b/tests/qemu-iotests/040.out
index 4fd1c2d..6d9bee1 100644
--- a/tests/qemu-iotests/040.out
+++ b/tests/qemu-iotests/040.out
@@ -1,5 +1,5 @@
-.........................
+...........................
----------------------------------------------------------------------
-Ran 25 tests
+Ran 27 tests
OK
--
2.7.4
- [Qemu-devel] [PATCH 56/79] target/xtensa: handle unknown registers in gdbstub, (continued)
- [Qemu-devel] [PATCH 56/79] target/xtensa: handle unknown registers in gdbstub, Michael Roth, 2017/08/28
- [Qemu-devel] [PATCH 57/79] commit: Fix use after free in completion, Michael Roth, 2017/08/28
- [Qemu-devel] [PATCH 62/79] blkverify: Catch bs->exact_filename overflow, Michael Roth, 2017/08/28
- [Qemu-devel] [PATCH 67/79] spapr: fix migration to pseries machine < 2.8, Michael Roth, 2017/08/28
- [Qemu-devel] [PATCH 66/79] hid: Reset kbd modifiers on reset, Michael Roth, 2017/08/28
- [Qemu-devel] [PATCH 60/79] commit: Fix completion with extra reference, Michael Roth, 2017/08/28
- [Qemu-devel] [PATCH 59/79] nbd: Fix regression on resiliency to port scan, Michael Roth, 2017/08/28
- [Qemu-devel] [PATCH 71/79] virtio-net: fix offload ctrl endian, Michael Roth, 2017/08/28
- [Qemu-devel] [PATCH 06/79] block: An empty filename counts as no filename, Michael Roth, 2017/08/28
- [Qemu-devel] [PATCH 72/79] input: limit kbd queue depth, Michael Roth, 2017/08/28
- [Qemu-devel] [PATCH 74/79] qemu-iotests: Test automatic commit job cancel on hot unplug,
Michael Roth <=
- [Qemu-devel] [PATCH 05/79] qemu-img/convert: Move bs_n > 1 && -B check down, Michael Roth, 2017/08/28
- [Qemu-devel] [PATCH 64/79] block: Do not strcmp() with NULL uri->scheme, Michael Roth, 2017/08/28
- [Qemu-devel] [PATCH 69/79] commit: Add NULL check for overlay_bs, Michael Roth, 2017/08/28
- [Qemu-devel] [PATCH 68/79] virtio-scsi: finalize IOMMU support, Michael Roth, 2017/08/28
- [Qemu-devel] [PATCH 73/79] input: Decrement queue count on kbd delay, Michael Roth, 2017/08/28
- [Qemu-devel] [PATCH 75/79] block: Skip implicit nodes in query-block/blockstats, Michael Roth, 2017/08/28
- [Qemu-devel] [PATCH 76/79] cpu: don't allow negative core id, Michael Roth, 2017/08/28
- [Qemu-devel] [PATCH 78/79] block/nfs: fix mutex assertion in nfs_file_close(), Michael Roth, 2017/08/28
- [Qemu-devel] [PATCH 07/79] iotests/051: Add test for empty filename, Michael Roth, 2017/08/28
- [Qemu-devel] [PATCH 70/79] spapr: fix memory leak in spapr_core_pre_plug(), Michael Roth, 2017/08/28