-
Notifications
You must be signed in to change notification settings - Fork 184
migration: Add case about migration with heavy nework load on host #6733
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| - migration.migration_with_stress.network_load_on_host: | ||
| type = network_load_on_host | ||
| 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' | ||
| image_convert = 'no' | ||
| server_ip = "${migrate_dest_host}" | ||
| server_user = "root" | ||
| server_pwd = "${migrate_dest_pwd}" | ||
| client_ip = "${migrate_source_host}" | ||
| status_error = "no" | ||
| migrate_desturi_port = "16509" | ||
| migrate_desturi_type = "tcp" | ||
| virsh_migrate_desturi = "qemu+tcp://${migrate_dest_host}/system" | ||
| start_vm = "yes" | ||
| virsh_migrate_options = '--live --p2p --verbose --undefinesource --persistent --postcopy' | ||
| virsh_migrate_dest_state = "running" | ||
| virsh_migrate_src_state = "nonexist" | ||
| netperf_port = "12865" | ||
| netperf_data_port = "5000" | ||
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
| @@ -0,0 +1,87 @@ | ||||
| # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||||
| # | ||||
| # Copyright Redhat | ||||
| # | ||||
| # SPDX-License-Identifier: GPL-2.0 | ||||
| # | ||||
| # Author: Liping Cheng <lcheng@redhat.com> | ||||
| # | ||||
| # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||||
|
|
||||
| from avocado.utils import process | ||||
|
|
||||
| from virttest import remote | ||||
| from virttest import utils_package | ||||
|
|
||||
| from provider.migration import base_steps | ||||
|
|
||||
|
|
||||
| def run(test, params, env): | ||||
| """ | ||||
| This case is to verify that migration can succeed in high-speed network env | ||||
| with heavy nework load | ||||
|
|
||||
| """ | ||||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||||
| def setup_test(): | ||||
| """ | ||||
| Setup steps | ||||
|
|
||||
| """ | ||||
| client_ip = params.get("client_ip") | ||||
|
|
||||
| test.log.info("Setup steps.") | ||||
| if not utils_package.package_install('netperf'): | ||||
| test.error('Failed to install netperf on source host.') | ||||
| if not utils_package.package_install('netperf', remote_session): | ||||
| test.error('Failed to install netperf on target host.') | ||||
|
|
||||
| process.run("systemctl stop firewalld", shell=True, verbose=True) | ||||
| remote.run_remote_cmd("systemctl stop firewalld", params) | ||||
|
|
||||
| src_netserver_cmd = f"nohup netserver >/dev/null 2>&1 &" | ||||
| process.run(src_netserver_cmd, shell=True, verbose=True) | ||||
| dst_netserver_cmd = f"nohup netserver >/dev/null 2>&1 &" | ||||
| remote.run_remote_cmd(dst_netserver_cmd, params, ignore_status=False) | ||||
|
|
||||
| src_netperf_cmd = f"nohup netperf -H {server_ip} -l 600000000 >/dev/null 2>&1 &" | ||||
| process.run(src_netperf_cmd, shell=True, verbose=True) | ||||
|
|
||||
| dst_netperf_cmd = f"nohup netperf -H {client_ip} -l 600000000 >/dev/null 2>&1 &" | ||||
| remote.run_remote_cmd(dst_netperf_cmd, params, ignore_status=False) | ||||
|
|
||||
| migration_obj.setup_connection() | ||||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||||
|
|
||||
| def cleanup_test(): | ||||
| """ | ||||
| Cleanup steps | ||||
|
|
||||
| """ | ||||
| test.log.info("Cleanup steps.") | ||||
| migration_obj.cleanup_connection() | ||||
| process.run("pkill netserver", shell=True, verbose=True, ignore_status=True) | ||||
| remote.run_remote_cmd("pkill netserver", params, ignore_status=True) | ||||
| process.run("pkill netperf", shell=True, verbose=True, ignore_status=True) | ||||
| remote.run_remote_cmd("pkill netperf", params, ignore_status=True) | ||||
| process.run("systemctl start firewalld", shell=True, verbose=True) | ||||
| remote.run_remote_cmd("systemctl start firewalld", params) | ||||
|
|
||||
| vm_name = params.get("migrate_main_vm") | ||||
| server_ip = params.get("server_ip") | ||||
| server_user = params.get("server_user", "root") | ||||
| server_pwd = params.get("server_pwd") | ||||
| netperf_port = params.get("netperf_port") | ||||
| netperf_data_port = params.get("netperf_data_port") | ||||
|
Comment on lines
+72
to
+73
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unused port configuration parameters. The Related to the unused parameters in the config file at lines 31-32. 🧰 Tools🪛 Ruff (0.14.8)72-72: Local variable Remove assignment to unused variable (F841) 73-73: Local variable Remove assignment to unused variable (F841) 🤖 Prompt for AI Agents |
||||
|
|
||||
| vm = env.get_vm(vm_name) | ||||
| migration_obj = base_steps.MigrationBase(test, vm, params) | ||||
| remote_runner = remote.RemoteRunner(host=server_ip, | ||||
| username=server_user, | ||||
| password=server_pwd) | ||||
| remote_session = remote_runner.session | ||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unused remote_session variable. The remote_runner = remote.RemoteRunner(host=server_ip,
username=server_user,
password=server_pwd)
- remote_session = remote_runner.session📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||
|
|
||||
| try: | ||||
| setup_test() | ||||
| migration_obj.run_migration() | ||||
| migration_obj.verify_default() | ||||
| finally: | ||||
| cleanup_test() | ||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
rg -n "\bnetperf_port\b|\bnetperf_data_port\b" libvirt/tests/src/migration/migration_with_stress/network_load_on_host.py -A 2 -B 2Repository: autotest/tp-libvirt
Length of output: 306
🏁 Script executed:
rg -n "netperf_port|netperf_data_port" libvirt/tests/src/migration/migration_with_stress/network_load_on_host.pyRepository: autotest/tp-libvirt
Length of output: 170
🏁 Script executed:
rg -n "netperf\b" libvirt/tests/src/migration/migration_with_stress/network_load_on_host.py -B 2 -A 2Repository: autotest/tp-libvirt
Length of output: 1374
Remove unused port parameters or pass them to netperf/netserver commands.
The
netperf_portandnetperf_data_portparameters are retrieved at lines 72-73 but never used anywhere in the test. The netperf invocations at lines 46 and 49 (netperf -H {ip} -l 600000000) don't specify these ports with the-pand-Pflags. Either configure the commands to use these ports or remove the unused parameters from the config.