From 44f28dcf5b2d0a0f914354a979aae18f01d6bfe7 Mon Sep 17 00:00:00 2001 From: "Dr. David Alan Gilbert" Date: Tue, 17 Apr 2018 16:07:19 +0100 Subject: [PATCH] Skip test if a migration capability isn't available If a test tries to use a migration capability that doesn't exist in that version of QEMU or can't be used in combination with some other setting then we'll get an exception. Trap this exception and cause the test to be skipped. Signed-off-by: Dr. David Alan Gilbert --- qemu/tests/migration.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/qemu/tests/migration.py b/qemu/tests/migration.py index cf4ba1a6..40181edf 100644 --- a/qemu/tests/migration.py +++ b/qemu/tests/migration.py @@ -10,6 +10,7 @@ from virttest import utils_misc from virttest import utils_test from virttest import utils_package from virttest import error_context +from virttest import qemu_monitor # For MonitorNotSupportedMigCapError @error_context.context_aware @@ -217,13 +218,18 @@ def run(test, params, env): logging.info("Round %s ping..." % str(i / 2)) else: logging.info("Round %s pong..." % str(i / 2)) - vm.migrate(mig_timeout, mig_protocol, mig_cancel_delay, - offline, check, - migration_exec_cmd_src=mig_exec_cmd_src, - migration_exec_cmd_dst=mig_exec_cmd_dst, - migrate_capabilities=capabilities, - mig_inner_funcs=inner_funcs, - env=env) + try: + vm.migrate(mig_timeout, mig_protocol, mig_cancel_delay, + offline, check, + migration_exec_cmd_src=mig_exec_cmd_src, + migration_exec_cmd_dst=mig_exec_cmd_dst, + migrate_capabilities=capabilities, + mig_inner_funcs=inner_funcs, + env=env) + except qemu_monitor.MonitorNotSupportedMigCapError as e: + test.cancel("Unable to access capability: %s" % e) + except: + raise # Set deamon thread action to stop after migrate params["action"] = "stop" -- GitLab