|
|
22c213 |
From 7e23b64dc20b64ca6fa887cd06cc5e52374f6268 Mon Sep 17 00:00:00 2001
|
|
|
22c213 |
From: Kevin Wolf <kwolf@redhat.com>
|
|
|
22c213 |
Date: Fri, 13 Mar 2020 12:34:30 +0000
|
|
|
22c213 |
Subject: [PATCH 10/20] iotests: Refactor blockdev-reopen test for iothreads
|
|
|
22c213 |
|
|
|
22c213 |
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
|
|
22c213 |
Message-id: <20200313123439.10548-5-kwolf@redhat.com>
|
|
|
22c213 |
Patchwork-id: 94281
|
|
|
22c213 |
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH v2 04/13] iotests: Refactor blockdev-reopen test for iothreads
|
|
|
22c213 |
Bugzilla: 1790482 1805143
|
|
|
22c213 |
RH-Acked-by: John Snow <jsnow@redhat.com>
|
|
|
22c213 |
RH-Acked-by: Daniel P. Berrange <berrange@redhat.com>
|
|
|
22c213 |
RH-Acked-by: Peter Krempa <pkrempa@redhat.com>
|
|
|
22c213 |
|
|
|
22c213 |
We'll want to test more than one successful case in the future, so
|
|
|
22c213 |
prepare the test for that by a refactoring that runs each scenario in a
|
|
|
22c213 |
separate VM.
|
|
|
22c213 |
|
|
|
22c213 |
test_iothreads_switch_{backing,overlay} currently produce errors, but
|
|
|
22c213 |
these are cases that should actually work, by switching either the
|
|
|
22c213 |
backing file node or the overlay node to the AioContext of the other
|
|
|
22c213 |
node.
|
|
|
22c213 |
|
|
|
22c213 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
22c213 |
Tested-by: Peter Krempa <pkrempa@redhat.com>
|
|
|
22c213 |
Message-Id: <20200306141413.30705-2-kwolf@redhat.com>
|
|
|
22c213 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
22c213 |
(cherry picked from commit 97518e11c3d902a32386d33797044f6b79bccc6f)
|
|
|
22c213 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
22c213 |
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
|
|
22c213 |
---
|
|
|
22c213 |
tests/qemu-iotests/245 | 47 ++++++++++++++++++++++++++++++++++++----------
|
|
|
22c213 |
tests/qemu-iotests/245.out | 4 ++--
|
|
|
22c213 |
2 files changed, 39 insertions(+), 12 deletions(-)
|
|
|
22c213 |
|
|
|
22c213 |
diff --git a/tests/qemu-iotests/245 b/tests/qemu-iotests/245
|
|
|
22c213 |
index e66a23c..f69c2fa 100644
|
|
|
22c213 |
--- a/tests/qemu-iotests/245
|
|
|
22c213 |
+++ b/tests/qemu-iotests/245
|
|
|
22c213 |
@@ -968,8 +968,7 @@ class TestBlockdevReopen(iotests.QMPTestCase):
|
|
|
22c213 |
self.assertEqual(self.get_node('hd1'), None)
|
|
|
22c213 |
self.assert_qmp(self.get_node('hd2'), 'ro', True)
|
|
|
22c213 |
|
|
|
22c213 |
- # We don't allow setting a backing file that uses a different AioContext
|
|
|
22c213 |
- def test_iothreads(self):
|
|
|
22c213 |
+ def run_test_iothreads(self, iothread_a, iothread_b, errmsg = None):
|
|
|
22c213 |
opts = hd_opts(0)
|
|
|
22c213 |
result = self.vm.qmp('blockdev-add', conv_keys = False, **opts)
|
|
|
22c213 |
self.assert_qmp(result, 'return', {})
|
|
|
22c213 |
@@ -984,20 +983,48 @@ class TestBlockdevReopen(iotests.QMPTestCase):
|
|
|
22c213 |
result = self.vm.qmp('object-add', qom_type='iothread', id='iothread1')
|
|
|
22c213 |
self.assert_qmp(result, 'return', {})
|
|
|
22c213 |
|
|
|
22c213 |
- result = self.vm.qmp('x-blockdev-set-iothread', node_name='hd0', iothread='iothread0')
|
|
|
22c213 |
+ result = self.vm.qmp('device_add', driver='virtio-scsi', id='scsi0',
|
|
|
22c213 |
+ iothread=iothread_a)
|
|
|
22c213 |
self.assert_qmp(result, 'return', {})
|
|
|
22c213 |
|
|
|
22c213 |
- self.reopen(opts, {'backing': 'hd2'}, "Cannot use a new backing file with a different AioContext")
|
|
|
22c213 |
-
|
|
|
22c213 |
- result = self.vm.qmp('x-blockdev-set-iothread', node_name='hd2', iothread='iothread1')
|
|
|
22c213 |
+ result = self.vm.qmp('device_add', driver='virtio-scsi', id='scsi1',
|
|
|
22c213 |
+ iothread=iothread_b)
|
|
|
22c213 |
self.assert_qmp(result, 'return', {})
|
|
|
22c213 |
|
|
|
22c213 |
- self.reopen(opts, {'backing': 'hd2'}, "Cannot use a new backing file with a different AioContext")
|
|
|
22c213 |
+ if iothread_a:
|
|
|
22c213 |
+ result = self.vm.qmp('device_add', driver='scsi-hd', drive='hd0',
|
|
|
22c213 |
+ share_rw=True, bus="scsi0.0")
|
|
|
22c213 |
+ self.assert_qmp(result, 'return', {})
|
|
|
22c213 |
|
|
|
22c213 |
- result = self.vm.qmp('x-blockdev-set-iothread', node_name='hd2', iothread='iothread0')
|
|
|
22c213 |
- self.assert_qmp(result, 'return', {})
|
|
|
22c213 |
+ if iothread_b:
|
|
|
22c213 |
+ result = self.vm.qmp('device_add', driver='scsi-hd', drive='hd2',
|
|
|
22c213 |
+ share_rw=True, bus="scsi1.0")
|
|
|
22c213 |
+ self.assert_qmp(result, 'return', {})
|
|
|
22c213 |
|
|
|
22c213 |
- self.reopen(opts, {'backing': 'hd2'})
|
|
|
22c213 |
+ # Attaching the backing file may or may not work
|
|
|
22c213 |
+ self.reopen(opts, {'backing': 'hd2'}, errmsg)
|
|
|
22c213 |
+
|
|
|
22c213 |
+ # But removing the backing file should always work
|
|
|
22c213 |
+ self.reopen(opts, {'backing': None})
|
|
|
22c213 |
+
|
|
|
22c213 |
+ self.vm.shutdown()
|
|
|
22c213 |
+
|
|
|
22c213 |
+ # We don't allow setting a backing file that uses a different AioContext if
|
|
|
22c213 |
+ # neither of them can switch to the other AioContext
|
|
|
22c213 |
+ def test_iothreads_error(self):
|
|
|
22c213 |
+ self.run_test_iothreads('iothread0', 'iothread1',
|
|
|
22c213 |
+ "Cannot use a new backing file with a different AioContext")
|
|
|
22c213 |
+
|
|
|
22c213 |
+ def test_iothreads_compatible_users(self):
|
|
|
22c213 |
+ self.run_test_iothreads('iothread0', 'iothread0')
|
|
|
22c213 |
+
|
|
|
22c213 |
+ def test_iothreads_switch_backing(self):
|
|
|
22c213 |
+ self.run_test_iothreads('iothread0', None,
|
|
|
22c213 |
+ "Cannot use a new backing file with a different AioContext")
|
|
|
22c213 |
+
|
|
|
22c213 |
+ def test_iothreads_switch_overlay(self):
|
|
|
22c213 |
+ self.run_test_iothreads(None, 'iothread0',
|
|
|
22c213 |
+ "Cannot use a new backing file with a different AioContext")
|
|
|
22c213 |
|
|
|
22c213 |
if __name__ == '__main__':
|
|
|
22c213 |
iotests.main(supported_fmts=["qcow2"],
|
|
|
22c213 |
diff --git a/tests/qemu-iotests/245.out b/tests/qemu-iotests/245.out
|
|
|
22c213 |
index a19de52..682b933 100644
|
|
|
22c213 |
--- a/tests/qemu-iotests/245.out
|
|
|
22c213 |
+++ b/tests/qemu-iotests/245.out
|
|
|
22c213 |
@@ -1,6 +1,6 @@
|
|
|
22c213 |
-..................
|
|
|
22c213 |
+.....................
|
|
|
22c213 |
----------------------------------------------------------------------
|
|
|
22c213 |
-Ran 18 tests
|
|
|
22c213 |
+Ran 21 tests
|
|
|
22c213 |
|
|
|
22c213 |
OK
|
|
|
22c213 |
{"execute": "job-finalize", "arguments": {"id": "commit0"}}
|
|
|
22c213 |
--
|
|
|
22c213 |
1.8.3.1
|
|
|
22c213 |
|