diff --git a/libvirt/tests/cfg/migration/migration_misc/qemu_err_incoming_migration.cfg b/libvirt/tests/cfg/migration/migration_misc/qemu_err_incoming_migration.cfg new file mode 100644 index 0000000000..fb3b2fb9b6 --- /dev/null +++ b/libvirt/tests/cfg/migration/migration_misc/qemu_err_incoming_migration.cfg @@ -0,0 +1,36 @@ +- migration.migration_misc.qemu_err_incoming_migration: + type = qemu_err_incoming_migration + 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 + 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}" + status_error = "yes" + migrate_desturi_port = "16509" + migrate_desturi_type = "tcp" + virsh_migrate_desturi = "qemu+tcp://${migrate_dest_host}/system" + err_msg = "unable to map backing store for guest RAM: Cannot allocate memory" + setup_hugepages = "yes" + start_vm = "no" + nr_hugepages_src = "2500" + nr_hugepages_dest = "0" + memory_backing = {'hugepages': {'pages': [{'size': '2048', 'unit': 'KiB'}]}} + variants: + - p2p: + virsh_migrate_options = '--live --p2p --verbose' + - non_p2p: + virsh_migrate_options = '--live --verbose' diff --git a/libvirt/tests/src/migration/migration_misc/qemu_err_incoming_migration.py b/libvirt/tests/src/migration/migration_misc/qemu_err_incoming_migration.py new file mode 100644 index 0000000000..ec935c3b96 --- /dev/null +++ b/libvirt/tests/src/migration/migration_misc/qemu_err_incoming_migration.py @@ -0,0 +1,68 @@ +from avocado.utils import process + +from virttest import remote + +from virttest.libvirt_xml import vm_xml + +from provider.migration import base_steps + +hugepage_num = None + + +def run(test, params, env): + """ + This case is to verify that libvirt can report reasonable error when QEMU + fails with incoming migration. + + :param test: test object + :param params: Dictionary with the test parameters + :param env: Dictionary with test environment. + """ + def setup_test(): + """ + Setup steps + + """ + memory_backing = eval(params.get("memory_backing", "{}")) + hugepage_file = params.get("kernel_hp_file", "/proc/sys/vm/nr_hugepages") + nr_hugepages_src = params.get("nr_hugepages_src") + nr_hugepages_dest = params.get("nr_hugepages_dest") + + test.log.info("Setup steps for cases.") + migration_obj.setup_connection() + global hugepage_num + with open(hugepage_file, 'r') as fp: + hugepage_num = int(fp.readline().strip()) + + process.run(f"sysctl vm.nr_hugepages={nr_hugepages_src}", shell=True) + remote.run_remote_cmd(f"sysctl vm.nr_hugepages={nr_hugepages_dest}", params) + vmxml = vm_xml.VMXML.new_from_inactive_dumpxml(vm_name) + mem_backing = vm_xml.VMMemBackingXML() + mem_backing.setup_attrs(**memory_backing) + vmxml.mb = mem_backing + vmxml.sync() + vm.start() + vm.wait_for_login().close() + + def cleanup_test(): + """ + Cleanup steps for cases + + """ + test.log.info("Cleanup steps for cases.") + global hugepage_num + process.run(f"sysctl vm.nr_hugepages={hugepage_num}", shell=True) + remote.run_remote_cmd(f"sysctl vm.nr_hugepages={hugepage_num}", params) + migration_obj.cleanup_connection() + + vm_name = params.get("migrate_main_vm") + + vm = env.get_vm(vm_name) + migration_obj = base_steps.MigrationBase(test, vm, params) + + try: + setup_test() + migration_obj.run_migration() + migration_obj.verify_default() + finally: + cleanup_test()