Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migration: Add bandwidth limit case #5234

Merged
merged 1 commit into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
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()
3 changes: 3 additions & 0 deletions provider/migration/migration_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

from virttest.libvirt_xml import vm_xml
from virttest.migration import MigrationTest
from virttest.utils_libvirt import libvirt_disk # pylint: disable=W0611
from virttest.utils_libvirt import libvirt_memory
from virttest.utils_libvirt import libvirt_monitor
from virttest.utils_libvirt import libvirt_network # pylint: disable=W0611
Expand Down Expand Up @@ -71,6 +72,8 @@ def parse_funcs(action_during_mig, test, params):
'before_pause': one_action.get('before_pause'),
'need_sleep_time': one_action.get('need_sleep_time'),
'func_param': func_param})
if one_action.get('wait_for_after_event_timeout'):
act_dict.update({'wait_for_after_event_timeout': one_action.get('wait_for_after_event_timeout')})
action_during_mig.append(act_dict)
return action_during_mig
else:
Expand Down
Loading