Skip to content

Commit

Permalink
iotests: Accommodate async QMP Exception classes
Browse files Browse the repository at this point in the history
(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 <[email protected]>
Reviewed-by: Hanna Reitz <[email protected]>
Reviewed-by: Kevin Wolf <[email protected]>
Message-id: [email protected]
Signed-off-by: John Snow <[email protected]>
  • Loading branch information
jnsnow committed Nov 1, 2021
1 parent 0f71c9a commit 3bd5594
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion scripts/simplebench/bench_block_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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:
Expand Down
5 changes: 3 additions & 2 deletions tests/qemu-iotests/tests/mirror-top-perms
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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',
Expand Down

0 comments on commit 3bd5594

Please sign in to comment.