qemu-kvm/kvm-iotests-Refactor-blockdev-reopen-test-for-iothreads.patch

123 lines
5.2 KiB
Diff
Raw Normal View History

* Tue Mar 17 2020 Danilo Cesar Lemes de Paula <ddepaula@redhat.com> - 4.2.0-15.el8 - kvm-block-nbd-Fix-hang-in-.bdrv_close.patch [bz#1640894] - kvm-block-Generic-file-creation-fallback.patch [bz#1640894] - kvm-file-posix-Drop-hdev_co_create_opts.patch [bz#1640894] - kvm-iscsi-Drop-iscsi_co_create_opts.patch [bz#1640894] - kvm-iotests-Add-test-for-image-creation-fallback.patch [bz#1640894] - kvm-block-Fix-leak-in-bdrv_create_file_fallback.patch [bz#1640894] - kvm-iotests-Use-complete_and_wait-in-155.patch [bz#1790482 bz#1805143] - kvm-block-Introduce-bdrv_reopen_commit_post-step.patch [bz#1790482 bz#1805143] - kvm-block-qcow2-Move-bitmap-reopen-into-bdrv_reopen_comm.patch [bz#1790482 bz#1805143] - kvm-iotests-Refactor-blockdev-reopen-test-for-iothreads.patch [bz#1790482 bz#1805143] - kvm-block-bdrv_reopen-with-backing-file-in-different-Aio.patch [bz#1790482 bz#1805143] - kvm-block-Versioned-x-blockdev-reopen-API-with-feature-f.patch [bz#1790482 bz#1805143] - kvm-block-Make-bdrv_get_cumulative_perm-public.patch [bz#1790482 bz#1805143] - kvm-block-Relax-restrictions-for-blockdev-snapshot.patch [bz#1790482 bz#1805143] - kvm-iotests-Fix-run_job-with-use_log-False.patch [bz#1790482 bz#1805143] - kvm-iotests-Test-mirror-with-temporarily-disabled-target.patch [bz#1790482 bz#1805143] - kvm-block-Fix-cross-AioContext-blockdev-snapshot.patch [bz#1790482 bz#1805143] - kvm-iotests-Add-iothread-cases-to-155.patch [bz#1790482 bz#1805143] - kvm-qapi-Add-allow-write-only-overlay-feature-for-blockd.patch [bz#1790482 bz#1805143] - kvm-exec-rom_reset-Free-rom-data-during-inmigrate-skip.patch [bz#1809380] - Resolves: bz#1640894 (Fix generic file creation fallback for qemu-img nvme:// image creation support) - Resolves: bz#1790482 (bitmaps in backing images can't be modified) - Resolves: bz#1805143 (allow late/lazy opening of backing chain for shallow blockdev-mirror) - Resolves: bz#1809380 (guest hang during reboot process after migration from RHEl7.8 to RHEL8.2.0.)
2020-03-17 00:52:27 +00:00
From 7e23b64dc20b64ca6fa887cd06cc5e52374f6268 Mon Sep 17 00:00:00 2001
From: Kevin Wolf <kwolf@redhat.com>
Date: Fri, 13 Mar 2020 12:34:30 +0000
Subject: [PATCH 10/20] iotests: Refactor blockdev-reopen test for iothreads
RH-Author: Kevin Wolf <kwolf@redhat.com>
Message-id: <20200313123439.10548-5-kwolf@redhat.com>
Patchwork-id: 94281
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH v2 04/13] iotests: Refactor blockdev-reopen test for iothreads
Bugzilla: 1790482 1805143
RH-Acked-by: John Snow <jsnow@redhat.com>
RH-Acked-by: Daniel P. Berrange <berrange@redhat.com>
RH-Acked-by: Peter Krempa <pkrempa@redhat.com>
We'll want to test more than one successful case in the future, so
prepare the test for that by a refactoring that runs each scenario in a
separate VM.
test_iothreads_switch_{backing,overlay} currently produce errors, but
these are cases that should actually work, by switching either the
backing file node or the overlay node to the AioContext of the other
node.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Tested-by: Peter Krempa <pkrempa@redhat.com>
Message-Id: <20200306141413.30705-2-kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 97518e11c3d902a32386d33797044f6b79bccc6f)
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
tests/qemu-iotests/245 | 47 ++++++++++++++++++++++++++++++++++++----------
tests/qemu-iotests/245.out | 4 ++--
2 files changed, 39 insertions(+), 12 deletions(-)
diff --git a/tests/qemu-iotests/245 b/tests/qemu-iotests/245
index e66a23c..f69c2fa 100644
--- a/tests/qemu-iotests/245
+++ b/tests/qemu-iotests/245
@@ -968,8 +968,7 @@ class TestBlockdevReopen(iotests.QMPTestCase):
self.assertEqual(self.get_node('hd1'), None)
self.assert_qmp(self.get_node('hd2'), 'ro', True)
- # We don't allow setting a backing file that uses a different AioContext
- def test_iothreads(self):
+ def run_test_iothreads(self, iothread_a, iothread_b, errmsg = None):
opts = hd_opts(0)
result = self.vm.qmp('blockdev-add', conv_keys = False, **opts)
self.assert_qmp(result, 'return', {})
@@ -984,20 +983,48 @@ class TestBlockdevReopen(iotests.QMPTestCase):
result = self.vm.qmp('object-add', qom_type='iothread', id='iothread1')
self.assert_qmp(result, 'return', {})
- result = self.vm.qmp('x-blockdev-set-iothread', node_name='hd0', iothread='iothread0')
+ result = self.vm.qmp('device_add', driver='virtio-scsi', id='scsi0',
+ iothread=iothread_a)
self.assert_qmp(result, 'return', {})
- self.reopen(opts, {'backing': 'hd2'}, "Cannot use a new backing file with a different AioContext")
-
- result = self.vm.qmp('x-blockdev-set-iothread', node_name='hd2', iothread='iothread1')
+ result = self.vm.qmp('device_add', driver='virtio-scsi', id='scsi1',
+ iothread=iothread_b)
self.assert_qmp(result, 'return', {})
- self.reopen(opts, {'backing': 'hd2'}, "Cannot use a new backing file with a different AioContext")
+ if iothread_a:
+ result = self.vm.qmp('device_add', driver='scsi-hd', drive='hd0',
+ share_rw=True, bus="scsi0.0")
+ self.assert_qmp(result, 'return', {})
- result = self.vm.qmp('x-blockdev-set-iothread', node_name='hd2', iothread='iothread0')
- self.assert_qmp(result, 'return', {})
+ if iothread_b:
+ result = self.vm.qmp('device_add', driver='scsi-hd', drive='hd2',
+ share_rw=True, bus="scsi1.0")
+ self.assert_qmp(result, 'return', {})
- self.reopen(opts, {'backing': 'hd2'})
+ # Attaching the backing file may or may not work
+ self.reopen(opts, {'backing': 'hd2'}, errmsg)
+
+ # But removing the backing file should always work
+ self.reopen(opts, {'backing': None})
+
+ self.vm.shutdown()
+
+ # We don't allow setting a backing file that uses a different AioContext if
+ # neither of them can switch to the other AioContext
+ def test_iothreads_error(self):
+ self.run_test_iothreads('iothread0', 'iothread1',
+ "Cannot use a new backing file with a different AioContext")
+
+ def test_iothreads_compatible_users(self):
+ self.run_test_iothreads('iothread0', 'iothread0')
+
+ def test_iothreads_switch_backing(self):
+ self.run_test_iothreads('iothread0', None,
+ "Cannot use a new backing file with a different AioContext")
+
+ def test_iothreads_switch_overlay(self):
+ self.run_test_iothreads(None, 'iothread0',
+ "Cannot use a new backing file with a different AioContext")
if __name__ == '__main__':
iotests.main(supported_fmts=["qcow2"],
diff --git a/tests/qemu-iotests/245.out b/tests/qemu-iotests/245.out
index a19de52..682b933 100644
--- a/tests/qemu-iotests/245.out
+++ b/tests/qemu-iotests/245.out
@@ -1,6 +1,6 @@
-..................
+.....................
----------------------------------------------------------------------
-Ran 18 tests
+Ran 21 tests
OK
{"execute": "job-finalize", "arguments": {"id": "commit0"}}
--
1.8.3.1