Skip to content

Commit

Permalink
Merge pull request #6050 from cliping/incoming
Browse files Browse the repository at this point in the history
migration: Add test about qemu fails with incoming migration
  • Loading branch information
chloerh authored Jan 16, 2025
2 parents 768f339 + 353bf50 commit 4584cd1
Show file tree
Hide file tree
Showing 2 changed files with 104 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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 <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}"
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'
Original file line number Diff line number Diff line change
@@ -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()

0 comments on commit 4584cd1

Please sign in to comment.