Skip to content

Commit

Permalink
migration: Add case about query domain job info
Browse files Browse the repository at this point in the history
XXXX - 297944 - VM live migration with copy storage - query
domain job info(domjobinfo)

Signed-off-by: lcheng <[email protected]>
  • Loading branch information
cliping committed Jan 12, 2024
1 parent 4f63166 commit 1aa5444
Show file tree
Hide file tree
Showing 5 changed files with 122 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"}}}
Original file line number Diff line number Diff line change
@@ -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 <domain> <desturi>
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"
12 changes: 9 additions & 3 deletions libvirt/tests/src/migration/async_job/migration_domjobinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright Red Hat
#
# SPDX-License-Identifier: GPL-2.0

# Author: Liping Cheng<[email protected]>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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)
12 changes: 8 additions & 4 deletions provider/migration/migration_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')),
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 1aa5444

Please sign in to comment.