[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 18/22] iotests: Accommodate async QMP Exception classes
From: |
John Snow |
Subject: |
[PULL 18/22] iotests: Accommodate async QMP Exception classes |
Date: |
Mon, 1 Nov 2021 13:30:02 -0400 |
(But continue to support the old ones for now, too.)
There are very few cases of any user of QEMUMachine or a subclass
thereof relying on a QMP Exception type. If you'd like to check for
yourself, you want to grep for all of the derivatives of QMPError,
excluding 'AQMPError' and its derivatives. That'd be these:
- QMPError
- QMPConnectError
- QMPCapabilitiesError
- QMPTimeoutError
- QMPProtocolError
- QMPResponseError
- QMPBadPortError
Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Hanna Reitz <hreitz@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Message-id: 20211026175612.4127598-5-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
---
scripts/simplebench/bench_block_job.py | 3 ++-
tests/qemu-iotests/tests/mirror-top-perms | 5 +++--
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/scripts/simplebench/bench_block_job.py
b/scripts/simplebench/bench_block_job.py
index 4f03c121697..a403c35b08f 100755
--- a/scripts/simplebench/bench_block_job.py
+++ b/scripts/simplebench/bench_block_job.py
@@ -28,6 +28,7 @@
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python'))
from qemu.machine import QEMUMachine
from qemu.qmp import QMPConnectError
+from qemu.aqmp import ConnectError
def bench_block_job(cmd, cmd_args, qemu_args):
@@ -49,7 +50,7 @@ def bench_block_job(cmd, cmd_args, qemu_args):
vm.launch()
except OSError as e:
return {'error': 'popen failed: ' + str(e)}
- except (QMPConnectError, socket.timeout):
+ except (QMPConnectError, ConnectError, socket.timeout):
return {'error': 'qemu failed: ' + str(vm.get_log())}
try:
diff --git a/tests/qemu-iotests/tests/mirror-top-perms
b/tests/qemu-iotests/tests/mirror-top-perms
index 3d475aa3a54..a2d5c269d7a 100755
--- a/tests/qemu-iotests/tests/mirror-top-perms
+++ b/tests/qemu-iotests/tests/mirror-top-perms
@@ -21,8 +21,9 @@
import os
-from qemu import qmp
+from qemu.aqmp import ConnectError
from qemu.machine import machine
+from qemu.qmp import QMPConnectError
import iotests
from iotests import qemu_img
@@ -102,7 +103,7 @@ class TestMirrorTopPerms(iotests.QMPTestCase):
self.vm_b.launch()
print('ERROR: VM B launched successfully, this should not have '
'happened')
- except qmp.QMPConnectError:
+ except (QMPConnectError, ConnectError):
assert 'Is another process using the image' in self.vm_b.get_log()
result = self.vm.qmp('block-job-cancel',
--
2.31.1
- [PULL 08/22] iotests/297: Change run_linter() to raise an exception on failure, (continued)
- [PULL 08/22] iotests/297: Change run_linter() to raise an exception on failure, John Snow, 2021/11/01
- [PULL 09/22] iotests/297: update tool availability checks, John Snow, 2021/11/01
- [PULL 10/22] iotests/297: split test into sub-cases, John Snow, 2021/11/01
- [PULL 11/22] iotests: split linters.py out from 297, John Snow, 2021/11/01
- [PULL 12/22] iotests/linters: Add entry point for linting via Python CI, John Snow, 2021/11/01
- [PULL 13/22] iotests/linters: Add workaround for mypy bug #9852, John Snow, 2021/11/01
- [PULL 14/22] python: Add iotest linters to test suite, John Snow, 2021/11/01
- [PULL 15/22] python/machine: remove has_quit argument, John Snow, 2021/11/01
- [PULL 16/22] python/machine: Handle QMP errors on close more meticulously, John Snow, 2021/11/01
- [PULL 17/22] python/aqmp: Remove scary message, John Snow, 2021/11/01
- [PULL 18/22] iotests: Accommodate async QMP Exception classes,
John Snow <=
- [PULL 19/22] iotests: Conditionally silence certain AQMP errors, John Snow, 2021/11/01
- [PULL 20/22] iotests/300: avoid abnormal shutdown race condition, John Snow, 2021/11/01
- [PULL 22/22] python, iotests: replace qmp with aqmp, John Snow, 2021/11/01
- [PULL 21/22] python/aqmp: Create sync QMP wrapper for iotests, John Snow, 2021/11/01
- Re: [PULL 00/22] Python patches, Richard Henderson, 2021/11/02