-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4981 from cliping/postcopy
migration: Add case about network bandwidth
- Loading branch information
Showing
6 changed files
with
223 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
libvirt/tests/cfg/migration/migration_resource_limit/migration_postcopy_bandwidth.cfg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
- migration.migration_resource_limit.migration_postcopy_bandwidth: | ||
type = migration_bandwidth | ||
migration_setup = 'yes' | ||
storage_type = 'nfs' | ||
setup_local_nfs = 'yes' | ||
disk_type = "file" | ||
disk_source_protocol = "netfs" | ||
mnt_path_name = ${nfs_mount_dir} | ||
# 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}" | ||
status_error = "no" | ||
check_network_accessibility_after_mig = "yes" | ||
migrate_desturi_port = "16509" | ||
migrate_desturi_type = "tcp" | ||
virsh_migrate_desturi = "qemu+tcp://${migrate_dest_host}/system" | ||
stress_package = "stress" | ||
stress_args = "--cpu 8 --io 4 --vm 2 --vm-bytes 128M --timeout 20s" | ||
postcopy_bandwidth = "10" | ||
jobinfo_item = "Memory bandwidth:" | ||
diff_rate = '0.7' | ||
compare_to_value = "${postcopy_bandwidth}" | ||
libvirtd_file_type = "virtqemud" | ||
libvirtd_debug_level = "1" | ||
libvirtd_debug_filters = "1:*" | ||
expected_event_src = ["Suspended Post-copy"] | ||
check_str_local_log = 'migrate-set-parameters.*max-postcopy-bandwidth":10485760' | ||
|
||
variants: | ||
- p2p: | ||
virsh_migrate_options = '--live --p2p --verbose' | ||
- non_p2p: | ||
virsh_migrate_options = '--live --verbose' | ||
variants: | ||
- with_postcopy: | ||
postcopy_options = '--postcopy' | ||
variants test_case: | ||
- default_bandwidth: | ||
compare_to_value = "8796093022207" | ||
diff_rate = '0' | ||
check_str_local_log = '.*"max-postcopy-bandwidth":9223372036853727232' | ||
action_during_mig = '[{"func": "check_domjobinfo_during_mig", "after_event": "iteration: '1'", "func_param": 'params'}, {"func": "virsh.migrate_postcopy", "func_param": "'%s' % params.get('migrate_main_vm')"}, {"func": "check_domjobinfo_during_mig", "func_param": "params"}, {"func": "set_migrate_speed_to_high", "func_param": "params"}]' | ||
- set_bandwidth_when_vm_running: | ||
action_during_mig = '[{"func": "virsh.migrate_postcopy", "after_event": "iteration: '1'", "func_param": "'%s' % params.get('migrate_main_vm')"}, {"func": "check_domjobinfo_during_mig", "func_param": "params", "need_sleep_time": "5"}, {"func": "set_migrate_speed_to_high", "func_param": "params"}]' | ||
- set_bandwidth_when_initiating_live_migration: | ||
postcopy_options = '--postcopy --postcopy-bandwidth ${postcopy_bandwidth}' | ||
action_during_mig = '[{"func": "virsh.migrate_postcopy", "after_event": "iteration: '1'", "func_param": "'%s' % params.get('migrate_main_vm')", "need_sleep_time": "3"}, {"func": "check_domjobinfo_during_mig", "func_param": "params", "need_sleep_time": "5"}, {"func": "set_migrate_speed_to_high", "func_param": "params"}]' | ||
- set_bandwidth_during_live_migration_precopy_phase: | ||
action_during_mig = '[{"func": "set_bandwidth", "after_event": "iteration: '1'", "func_param": "params"}, {"func": "virsh.migrate_postcopy", "func_param": "'%s' % params.get('migrate_main_vm')"}, {"func": "check_domjobinfo_during_mig", "func_param": "params", "need_sleep_time": "5"}, {"func": "set_migrate_speed_to_high", "func_param": "params"}]' | ||
- set_bandwidth_during_live_migration_postcopy_phase: | ||
action_during_mig = '[{"func": "virsh.migrate_postcopy", "after_event": "iteration: '1'", "func_param": "'%s' % params.get('migrate_main_vm')"}, {"func": "set_bandwidth", "func_param": "params"}, {"func": "check_domjobinfo_during_mig", "func_param": "params", "need_sleep_time": "5"}, {"func": "set_migrate_speed_to_high", "func_param": "params"}]' |
56 changes: 56 additions & 0 deletions
56
...tests/cfg/migration/migration_resource_limit/migration_precopy_and_postcopy_bandwidth.cfg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
- migration.migration_resource_limit.migration_precopy_and_postcopy_bandwidth: | ||
type = migration_bandwidth | ||
migration_setup = 'yes' | ||
storage_type = 'nfs' | ||
setup_local_nfs = 'yes' | ||
disk_type = "file" | ||
disk_source_protocol = "netfs" | ||
mnt_path_name = ${nfs_mount_dir} | ||
# 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}" | ||
status_error = "no" | ||
check_network_accessibility_after_mig = "yes" | ||
migrate_desturi_port = "16509" | ||
migrate_desturi_type = "tcp" | ||
virsh_migrate_desturi = "qemu+tcp://${migrate_dest_host}/system" | ||
stress_package = "stress" | ||
stress_args = "--cpu 8 --io 4 --vm 2 --vm-bytes 128M --timeout 20s" | ||
domjob_ignore_status = "False" | ||
jobinfo_item = "Memory bandwidth:" | ||
diff_rate = '0.7' | ||
libvirtd_file_type = "virtqemud" | ||
libvirtd_debug_level = "1" | ||
libvirtd_debug_filters = "1:*" | ||
expected_event_src = ["Suspended Post-copy"] | ||
check_str_local_log = 'migrate-set-parameters.*max-bandwidth":5242880' | ||
check_postcopy_log = 'migrate-set-parameters.*max-postcopy-bandwidth":10485760' | ||
precopy_bandwidth = "5" | ||
postcopy_bandwidth = "10" | ||
compare_to_value = "${postcopy_bandwidth}" | ||
action_during_mig = '[{"func": "check_domjobinfo_precopy", "after_event": "iteration: '1'", "func_param": "params"}, {"func": "virsh.migrate_postcopy", "func_param": "'%s' % params.get('migrate_main_vm')"}, {"func": "check_domjobinfo_during_mig", "func_param": "params"}, {"func": "set_migrate_speed_to_high", "func_param": "params"}]' | ||
|
||
variants: | ||
- p2p: | ||
virsh_migrate_options = '--live --p2p --verbose' | ||
- non_p2p: | ||
virsh_migrate_options = '--live --verbose' | ||
variants: | ||
- with_postcopy: | ||
postcopy_options = '--postcopy' | ||
variants test_case: | ||
- set_bandwidth_when_vm_running: | ||
- set_bandwidth_when_initiating_live_migration: | ||
postcopy_options = '--bandwidth ${precopy_bandwidth} --postcopy --postcopy-bandwidth ${postcopy_bandwidth}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
libvirt/tests/src/migration/migration_resource_limit/migration_bandwidth.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
from virttest import virsh | ||
|
||
from virttest.utils_test import libvirt | ||
|
||
from provider.migration import base_steps | ||
from provider.migration import migration_base | ||
|
||
|
||
def run(test, params, env): | ||
""" | ||
Test network bandwidth - postcopy. | ||
:param test: test object | ||
:param params: Dictionary with the test parameters | ||
:param env: Dictionary with test environment. | ||
""" | ||
def setup_default_bandwidth(): | ||
""" | ||
Setup for default_bandwidth | ||
""" | ||
compare_to_value = params.get("compare_to_value") | ||
|
||
test.log.debug("Setup for default_bandwidth.") | ||
migration_obj.setup_connection() | ||
speed = virsh.migrate_getspeed(vm_name, debug=True).stdout.strip() | ||
if compare_to_value != speed: | ||
test.fail("Default bandwidth is not 0.") | ||
|
||
def setup_set_bandwidth_when_vm_running(): | ||
""" | ||
Setup bandwidth when vm running | ||
""" | ||
test.log.debug("Setup bandwidth when vm running.") | ||
migration_obj.setup_connection() | ||
migration_base.set_bandwidth(params) | ||
|
||
def verify_test(): | ||
""" | ||
Verify steps | ||
""" | ||
check_postcopy_log = params.get("check_postcopy_log") | ||
log_file = params.get("libvirtd_debug_file") | ||
|
||
test.log.debug("Verify steps.") | ||
migration_obj.verify_default() | ||
if check_postcopy_log: | ||
libvirt.check_logfile(check_postcopy_log, log_file) | ||
migration_base.check_event_output(params, test, virsh_session) | ||
|
||
test_case = params.get('test_case', '') | ||
vm_name = params.get("migrate_main_vm") | ||
|
||
virsh_session = None | ||
|
||
vm = env.get_vm(vm_name) | ||
params.update({'vm_obj': vm}) | ||
migration_obj = base_steps.MigrationBase(test, vm, params) | ||
setup_test = eval("setup_%s" % test_case) if "setup_%s" % test_case in \ | ||
locals() else migration_obj.setup_connection | ||
|
||
try: | ||
virsh_session, _ = migration_base.monitor_event(params) | ||
setup_test() | ||
migration_obj.run_migration() | ||
verify_test() | ||
finally: | ||
migration_obj.cleanup_connection() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters