-
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.
VIRT-297906 - VM live migration with copy storage - bandwidth limit Signed-off-by: lcheng <[email protected]>
- Loading branch information
Showing
3 changed files
with
116 additions
and
0 deletions.
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
libvirt/tests/cfg/migration_with_copy_storage/migration_bandwidth_limit.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,54 @@ | ||
- migration_with_copy_storage.migration_bandwidth_limit: | ||
type = migration_bandwidth_limit | ||
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 | ||
start_vm = "yes" | ||
# 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}" | ||
status_error = "no" | ||
simple_disk_check_after_mig = "no" | ||
migrate_desturi_port = "16509" | ||
migrate_desturi_type = "tcp" | ||
virsh_migrate_desturi = "qemu+tcp://${migrate_dest_host}/system" | ||
setup_nfs = "no" | ||
nfs_mount_dir = | ||
bandwidth = "20" | ||
jobinfo_item = "Memory bandwidth:" | ||
precopy_bandwidth = "${bandwidth}" | ||
compare_to_value = "${bandwidth}" | ||
check_item = "bandwidth" | ||
check_item_value = "20971520" | ||
action_during_mig = '[{"func": "libvirt_disk.check_item_by_blockjob", "after_event": "block-job", "before_event": "migration-iteration", "func_param": "params", "wait_for_after_event_timeout": "600"}, {"func": "check_domjobinfo_during_mig", "after_event": "migration-iteration", "func_param": "params"}]' | ||
migrate_start_state = "running" | ||
variants: | ||
- p2p: | ||
virsh_migrate_options = "--live --p2p --verbose" | ||
- non_p2p: | ||
virsh_migrate_options = "--live --verbose" | ||
variants set_bandwidth: | ||
- bandwidth: | ||
virsh_migrate_extra = "--bandwidth ${bandwidth}" | ||
- setspeed_before_migration: | ||
- setspeed_during_migration: | ||
virsh_migrate_extra = "--bandwidth 30" | ||
action_during_mig = '[{"func": "set_bandwidth", "after_event": "block-job", "func_param": "params", "wait_for_after_event_timeout": "600"}, {"func": "libvirt_disk.check_item_by_blockjob", "func_param": "params"}, {"func": "check_domjobinfo_during_mig", "func_param": "params"}]' | ||
variants: | ||
- copy_storage_all: | ||
copy_storage_option = "--copy-storage-all" | ||
- copy_storage_inc: | ||
copy_storage_option = "--copy-storage-inc" |
59 changes: 59 additions & 0 deletions
59
libvirt/tests/src/migration_with_copy_storage/migration_bandwidth_limit.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,59 @@ | ||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
# | ||
# Copyright Redhat | ||
# | ||
# SPDX-License-Identifier: GPL-2.0 | ||
# | ||
# Author: Liping Cheng <[email protected]> | ||
# | ||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
from virttest import virsh | ||
|
||
from provider.migration import base_steps | ||
|
||
|
||
def run(test, params, env): | ||
""" | ||
To verify that bandwidth limit can take effect for storage copying during | ||
migration. | ||
:param test: test object | ||
:param params: Dictionary with the test parameters | ||
:param env: Dictionary with test environment. | ||
""" | ||
def setup_setspeed_before_migration(): | ||
""" | ||
Setup for setspeed_before_migration | ||
""" | ||
bandwidth = params.get("bandwidth") | ||
|
||
test.log.info("Setup bandwidth limit before migration.") | ||
migration_obj.setup_connection() | ||
virsh.migrate_setspeed(vm_name, bandwidth, debug=True) | ||
|
||
def cleanup_test(): | ||
""" | ||
Cleanup steps | ||
""" | ||
migration_obj.cleanup_connection() | ||
base_steps.cleanup_disks_remote(params, vm) | ||
|
||
set_bandwidth = params.get('set_bandwidth', '') | ||
vm_name = params.get("migrate_main_vm") | ||
|
||
vm = env.get_vm(vm_name) | ||
params.update({'vm_obj': vm}) | ||
migration_obj = base_steps.MigrationBase(test, vm, params) | ||
setup_test = eval("setup_%s" % set_bandwidth) if "setup_%s" % set_bandwidth in \ | ||
locals() else migration_obj.setup_connection | ||
|
||
try: | ||
setup_test() | ||
base_steps.prepare_disks_remote(params, vm) | ||
migration_obj.run_migration() | ||
migration_obj.verify_default() | ||
finally: | ||
cleanup_test() |
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