forked from autotest/tp-libvirt
-
Notifications
You must be signed in to change notification settings - Fork 1
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 autotest#5288 from cliping/io
migration: Add case about heavy disk I/O load in vm
- Loading branch information
Showing
2 changed files
with
120 additions
and
0 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
libvirt/tests/cfg/migration_with_copy_storage/disk_io_load_in_vm.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,40 @@ | ||
- migration_with_copy_storage.disk_io_load_in_vm: | ||
type = disk_io_load_in_vm | ||
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" | ||
image_convert = "no" | ||
migrate_desturi_port = "16509" | ||
migrate_desturi_type = "tcp" | ||
virsh_migrate_desturi = "qemu+tcp://${migrate_dest_host}/system" | ||
start_vm = "yes" | ||
setup_nfs = "no" | ||
nfs_mount_dir = | ||
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" | ||
variants: | ||
- p2p: | ||
virsh_migrate_options = "--live --p2p --verbose" | ||
- non_p2p: | ||
virsh_migrate_options = "--live --verbose" | ||
variants: | ||
- with_sync_writes: | ||
virsh_migrate_extra = "--copy-storage-synchronous-writes" | ||
- without_sync_writes: | ||
variants: | ||
- copy_storage_all: | ||
copy_storage_option = "--copy-storage-all" | ||
- copy_storage_inc: | ||
copy_storage_option = "--copy-storage-inc" |
80 changes: 80 additions & 0 deletions
80
libvirt/tests/src/migration_with_copy_storage/disk_io_load_in_vm.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,80 @@ | ||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
# | ||
# Copyright Redhat | ||
# | ||
# SPDX-License-Identifier: GPL-2.0 | ||
# | ||
# Author: Liping Cheng <[email protected]> | ||
# | ||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
from virttest import remote | ||
from virttest import utils_package | ||
|
||
from provider.migration import base_steps | ||
|
||
|
||
def run(test, params, env): | ||
""" | ||
To verify that vm migration can succeed when there is heavy disk I/O load | ||
in vm. | ||
:param test: test object | ||
:param params: Dictionary with the test parameters | ||
:param env: Dictionary with test environment. | ||
""" | ||
def setup_test(): | ||
""" | ||
Setup steps | ||
""" | ||
test.log.info("Setup steps.") | ||
migration_obj.setup_connection() | ||
session = vm.wait_for_login() | ||
utils_package.package_install(["gcc", "fio"], session, 360) | ||
shell_file = "/tmp/fio_test.sh" | ||
fio_cmd = ['while true', | ||
'do', | ||
' fio -name=aaa -direct=1 -iodepth=32 -rw=randrw -ioengine=libaio -bs=16k -size=1G -numjobs=2 -group_reporting -directory=/ &>/dev/null', | ||
'done'] | ||
remote_file = remote.RemoteFile(vm.get_address(), 'scp', 'root', | ||
params.get('password'), 22, | ||
shell_file) | ||
remote_file.truncate() | ||
remote_file.add(fio_cmd) | ||
session.cmd('chmod 777 %s' % shell_file) | ||
session.cmd('%s &' % shell_file) | ||
session.close() | ||
|
||
def verify_test(): | ||
""" | ||
Verify steps | ||
""" | ||
dest_uri = params.get("virsh_migrate_desturi") | ||
|
||
test.log.info("Verify steps.") | ||
backup_uri, vm.connect_uri = vm.connect_uri, dest_uri | ||
vm.cleanup_serial_console() | ||
vm.create_serial_console() | ||
remote_vm_session = vm.wait_for_serial_login(timeout=360) | ||
remote_vm_dmesg = remote_vm_session.cmd_output("dmesg") | ||
if "I/O error" in remote_vm_dmesg: | ||
test.fail(f"Found I/O error in guest dmesg: {remote_vm_dmesg}") | ||
remote_vm_session.close() | ||
vm.connect_uri = backup_uri | ||
|
||
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: | ||
setup_test() | ||
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) |