diff --git a/libvirt/tests/cfg/migration/async_job/migration_domjobinfo.cfg b/libvirt/tests/cfg/migration/async_job/migration_domjobinfo.cfg index eed5f6ccb4..18b8a5910e 100644 --- a/libvirt/tests/cfg/migration/async_job/migration_domjobinfo.cfg +++ b/libvirt/tests/cfg/migration/async_job/migration_domjobinfo.cfg @@ -36,11 +36,11 @@ virsh_migrate_options = '--live --verbose' variants: - with_precopy: - action_during_mig = '[{"func": "libvirt_monitor.check_domjobinfo_output", "after_event": "iteration: '1'", "func_param": "params", "need_sleep_time": "5"}, {"func": "set_migrate_speed_to_high", "func_param": "params"}]' expected_domjobinfo = {"src_items": {"str_items": {"Job type": "Unbounded", "Operation": "Outgoing migration"}, "int_items": {"Postcopy requests": "0"}, "all_items": ["Time elapsed", "Data processed", "Data remaining", "Data total", "Memory processed", "Memory remaining", "Memory total", "Memory bandwidth", "Dirty rate", "Page size", "Iteration", "Constant pages", "Normal pages", "Normal data", "Expected downtime", "Setup time"]}, "dest_items": {"error_msg": "migration statistics are available only on the source host"}} + action_during_mig = [{"func": "libvirt_monitor.check_domjobinfo_output", "after_event": "iteration: '1'", "func_param": {"vm_name": "${main_vm}", "expected_domjobinfo": ${expected_domjobinfo}, "remote_ip": "${server_ip}"}, "need_sleep_time": "5"}, {"func": "set_migrate_speed_to_high", "func_param": "params"}] expected_domjobinfo_complete = {"src_items": {"str_items": {"Job type": "Completed", "Operation": "Outgoing migration"}, "int_items": {"Postcopy requests": "0", "Memory remaining": "0", "Data remaining": "0", "Dirty rate": "0"}, "all_items": ["Time elapsed", "Data processed", "Data total", "Memory processed", "Memory total", "Memory bandwidth", "Page size", "Iteration", "Constant pages", "Normal pages", "Normal data", "Total downtime", "Setup time"]}, "dest_items": {"str_items": {"Job type": "Completed", "Operation": "Incoming migration"}, "int_items": {"Postcopy requests": "0", "Memory remaining": "0", "Data remaining": "0", "Dirty rate": "0"}, "all_items": ["Time elapsed", "Data processed", "Data total", "Memory processed", "Memory total", "Memory bandwidth", "Page size", "Iteration", "Constant pages", "Normal pages", "Normal data", "Total downtime", "Setup time"]}} - with_postcopy: postcopy_options = '--postcopy --timeout 10 --timeout-postcopy' - action_during_mig = '[{"func": "libvirt_monitor.check_domjobinfo_output", "after_event": "iteration: '1'", "func_param": "params", "need_sleep_time": "15"}, {"func": "set_migrate_speed_to_high", "func_param": "params"}]' expected_domjobinfo = {"src_items": {"str_items": {"Job type": "Unbounded", "Operation": "Outgoing migration"}, "all_items": ["Time elapsed", "Data processed", "Data remaining", "Data total", "Memory processed", "Memory remaining", "Memory total", "Memory bandwidth", "Dirty rate", "Page size", "Iteration", "Postcopy requests", "Constant pages", "Normal pages", "Normal data", "Expected downtime", "Setup time"]}, "dest_items": {"error_msg": "migration statistics are available only on the source host"}} + action_during_mig = [{"func": "libvirt_monitor.check_domjobinfo_output", "after_event": "iteration: '1'", "func_param": {"vm_name": "${main_vm}", "expected_domjobinfo": ${expected_domjobinfo}, "remote_ip": "${server_ip}"}, "need_sleep_time": "15"}, {"func": "set_migrate_speed_to_high", "func_param": "params"}] expected_domjobinfo_complete = {"src_items": {"str_items": {"Job type": "Completed", "Operation": "Outgoing migration"}, "int_items": {"Memory remaining": "0", "Data remaining": "0", "Dirty rate": "0"}, "all_items": ["Time elapsed", "Data processed", "Data total", "Memory processed", "Memory total", "Memory bandwidth", "Page size", "Iteration", "Postcopy requests", "Constant pages", "Normal pages", "Normal data", "Total downtime", "Setup time"]}, "dest_items": {"str_items": {"Job type": "None"}}} diff --git a/libvirt/tests/cfg/migration_with_copy_storage/async_job/query_domain_job_info.cfg b/libvirt/tests/cfg/migration_with_copy_storage/async_job/query_domain_job_info.cfg new file mode 100644 index 0000000000..ce07d92607 --- /dev/null +++ b/libvirt/tests/cfg/migration_with_copy_storage/async_job/query_domain_job_info.cfg @@ -0,0 +1,54 @@ +- migration_with_copy_storage.async_job.query_domain_job_info: + type = query_domain_job_info + migration_setup = 'yes' + # Console output can only be monitored via virsh console output + only_pty = True + take_regular_screendumps = no + # Extra options to pass after + virsh_migrate_extra = '' + # SSH connection time out + ssh_timeout = 60 + # Local URI + virsh_migrate_connect_uri = 'qemu:///system' + virsh_migrate_dest_state = "running" + virsh_migrate_src_state = "shut off" + image_convert = 'no' + server_ip = "${migrate_dest_host}" + server_user = "root" + server_pwd = "${migrate_dest_pwd}" + client_ip = "${migrate_source_host}" + client_user = "root" + client_pwd = "${migrate_source_pwd}" + check_network_accessibility_after_mig = "yes" + migrate_desturi_port = "16509" + migrate_desturi_type = "tcp" + virsh_migrate_desturi = "qemu+tcp://${migrate_dest_host}/system" + setup_nfs = "no" + nfs_mount_dir = + status_error = "no" + str_items = {"Job type": "Unbounded", "Operation": "Outgoing migration"} + s_all_items = ["Time elapsed", "Data processed", "Data remaining", "Data total", "File processed", "File remaining", "File total"] + m_all_items = ["Time elapsed", "Data remaining", "Memory processed", "Memory remaining", "Memory total", "Memory bandwidth", "Page size", "Iteration", "File processed", "File total", "Constant pages", "Normal pages", "Normal data", "Expected downtime", "Setup time"] + m_int_items = {"Dirty rate": "0", "Postcopy requests": "0", "File remaining": "0"} + m_sum_items = {"Data processed": "Memory processed+File processed", "Data total": "Memory total+File total"} + dest_items = {"error_msg": "migration statistics are available only on the source host"} + s_domjobinfo = {"src_items": {"str_items": ${str_items}, "all_items": ${s_all_items}}, "dest_items": ${dest_items}} + m_domjobinfo = {"src_items": {"str_items": ${str_items}, "all_items": ${m_all_items}, "int_items": ${m_int_items}, "sum_items": ${m_sum_items}}, "dest_items": ${dest_items}} + action_during_mig = [{"func": "libvirt_monitor.check_domjobinfo_output", "func_param": {"vm_name": "${main_vm}", "expected_domjobinfo": ${s_domjobinfo}, "remote_ip": "${server_ip}"}, "need_sleep_time": "5"}, {"func": "libvirt_monitor.check_domjobinfo_output", "after_event": "migration-iteration", "func_param": {"vm_name": "${main_vm}", "expected_domjobinfo": ${m_domjobinfo}, "remote_ip": "${server_ip}"}, "wait_for_after_event_timeout": 120}] + src_str_items_complete = {"Job type": "Completed", "Operation": "Outgoing migration"} + src_all_items_complete = ["Time elapsed", "Time elapsed w/o network", "Data processed", "Data total", "Memory processed", "Memory total", "Memory bandwidth", "Page size", "Iteration", "File processed", "File total", "Constant pages", "Normal pages", "Normal data", "Total downtime", "Downtime w/o network", "Setup time"] + src_int_items_complete = {"Data remaining": "0", "Memory remaining": "0", "Dirty rate": "0", "Postcopy requests": "0", "File remaining": "0"} + dest_str_items_complete = {"Job type": "Completed", "Operation": "Incoming migration"} + dest_all_items_complete = ["Time elapsed", "Time elapsed w/o network", "Data processed", "Data total", "Memory processed", "Memory total", "Memory bandwidth", "Page size", "Iteration", "Constant pages", "Normal pages", "Normal data", "Total downtime", "Downtime w/o network", "Setup time"] + dest_int_items_complete = {"Data remaining": "0", "Memory remaining": "0", "Dirty rate": "0", "Postcopy requests": "0"} + domjobinfo_complete = {"src_items": {"str_items": ${src_str_items_complete}, "all_items": ${src_all_items_complete}, "int_items": ${src_int_items_complete}}, "dest_items": {"str_items": ${dest_str_items_complete}, "all_items": ${dest_all_items_complete}, "int_items": ${dest_int_items_complete}}} + variants: + - p2p: + virsh_migrate_options = '--live --p2p --verbose' + - non_p2p: + virsh_migrate_options = '--live --verbose' + variants: + - copy_storage_all: + copy_storage_option = "--copy-storage-all" + - copy_storage_inc: + copy_storage_option = "--copy-storage-inc" diff --git a/libvirt/tests/src/migration/async_job/migration_domjobinfo.py b/libvirt/tests/src/migration/async_job/migration_domjobinfo.py index 434a7873e7..9ee30e8d49 100644 --- a/libvirt/tests/src/migration/async_job/migration_domjobinfo.py +++ b/libvirt/tests/src/migration/async_job/migration_domjobinfo.py @@ -16,12 +16,18 @@ def verify_test(): Verify steps """ - expected_domjobinfo_complete = params.get("expected_domjobinfo_complete") + expected_domjobinfo_complete = eval(params.get("expected_domjobinfo_complete")) + remote_ip = params.get("server_ip") + postcopy_options = params.get("postcopy_options") + test.log.info("Verify test.") migration_obj.verify_default() if expected_domjobinfo_complete: - params.update({"domjobinfo_options": "--completed"}) - libvirt_monitor.check_domjobinfo_output(params) + libvirt_monitor.check_domjobinfo_output(vm_name, + expected_domjobinfo_complete=expected_domjobinfo_complete, + options="--completed", + postcopy_options=postcopy_options, + remote_ip=remote_ip) vm_name = params.get("migrate_main_vm") diff --git a/libvirt/tests/src/migration_with_copy_storage/async_job/query_domain_job_info.py b/libvirt/tests/src/migration_with_copy_storage/async_job/query_domain_job_info.py new file mode 100644 index 0000000000..c46f2c6108 --- /dev/null +++ b/libvirt/tests/src/migration_with_copy_storage/async_job/query_domain_job_info.py @@ -0,0 +1,49 @@ +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright Red Hat +# +# SPDX-License-Identifier: GPL-2.0 + +# Author: Liping Cheng +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +from virttest.utils_libvirt import libvirt_monitor + +from provider.migration import base_steps + + +def run(test, params, env): + """ + To verify that domain job info can be queried during and after live + migration with copy storage. + + """ + def verify_test(): + """ + Verify test + + """ + domjobinfo_complete = eval(params.get("domjobinfo_complete")) + remote_ip = params.get("server_ip") + + test.log.info("Verify test.") + libvirt_monitor.check_domjobinfo_output(vm_name, + expected_domjobinfo_complete=domjobinfo_complete, + options="--completed", + remote_ip=remote_ip) + migration_obj.verify_default() + + vm_name = params.get("migrate_main_vm") + vm = env.get_vm(vm_name) + migration_obj = base_steps.MigrationBase(test, vm, params) + + try: + migration_obj.setup_connection() + base_steps.prepare_disks_remote(params, vm) + migration_obj.run_migration() + verify_test() + finally: + migration_obj.cleanup_connection() + base_steps.cleanup_disks_remote(params, vm) diff --git a/provider/migration/migration_base.py b/provider/migration/migration_base.py index f14f26d8ec..dce2903672 100644 --- a/provider/migration/migration_base.py +++ b/provider/migration/migration_base.py @@ -63,7 +63,7 @@ def parse_funcs(action_during_mig, test, params): "action_during_mig_again' is required") act_dict = {} func_param = one_action.get('func_param') - if func_param: + if func_param and isinstance(func_param, str): func_param = eval(func_param) act_dict.update({'func': eval(one_action.get('func')), @@ -513,14 +513,18 @@ def do_common_check(params): second_bandwidth = params.get("second_bandwidth") migration_obj = params.get("migration_obj") vm_name = params.get("main_vm") + remote_ip = params.get("server_ip") + postcopy_options = params.get("postcopy_options") if migration_options == "postcopy_bandwidth" and second_bandwidth: libvirt_domjobinfo.check_domjobinfo(migration_obj.vm, params) # check job info when migration is in paused status - expected_domjobinfo = '{"src_items": {"str_items": {"Job type": "Unbounded", "Operation": "Outgoing migration"}}}' - params.update({"expected_domjobinfo": expected_domjobinfo}) - libvirt_monitor.check_domjobinfo_output(params) + expected_domjobinfo = {"src_items": {"str_items": {"Job type": "Unbounded", "Operation": "Outgoing migration"}}} + libvirt_monitor.check_domjobinfo_output(vm_name, + expected_domjobinfo=expected_domjobinfo, + postcopy_options=postcopy_options, + remote_ip=remote_ip) # check domain state with reason check_vm_state(params)