diff --git a/qemu/tests/cfg/migrate.cfg b/qemu/tests/cfg/migrate.cfg index 9699251ecd..4517996aa1 100644 --- a/qemu/tests/cfg/migrate.cfg +++ b/qemu/tests/cfg/migrate.cfg @@ -14,6 +14,16 @@ # you can uncomment the following line to enable the state # check # vmstate_check = yes + take_regular_screendumps = no # FIXME: + store_vm_info = no # FIXME: + nodes = node1 node2 + node_selectors_node1 = [{"key": "cpu_vendor_id", "operator": "eq", "values": "AuthenticAMD"}, {"key": "hostname", "operator": "contains", "values": "redhat.com"}] + node_selectors_node2 = [{"key": "cpu_vendor_id", "operator": "==", "values": "AuthenticAMD"}, {"key": "hostname", "operator": "contains", "values": "redhat.com"}] + pools = p1 + vm_node = node1 + mig_dest_node = node2 + pool_selectors_p1 = [{"key": "type", "operator": "==", "values": "nfs"}, {"key": "access.nodes", "operator": "contains", "values": ["node1", "node2"]}] + image_pool_name_image1 = p1 variants: - @default: - with_filter_off: diff --git a/qemu/tests/migration.py b/qemu/tests/migration.py index eb9aebd42b..bd6b6b9e6b 100644 --- a/qemu/tests/migration.py +++ b/qemu/tests/migration.py @@ -229,8 +229,10 @@ def guest_stress_deamon(): for func in pre_migrate: func(vm, params, test) if i % 2 == 0: + dst_node = params.get("mig_dest_node") test.log.info("Round %s ping...", str(i / 2)) else: + dst_node = params.get("vm_node") test.log.info("Round %s pong...", str(i / 2)) try: vm.migrate( @@ -239,6 +241,7 @@ def guest_stress_deamon(): mig_cancel_delay, offline, check, + dest_host=dst_node, migration_exec_cmd_src=mig_exec_cmd_src, migration_exec_cmd_dst=mig_exec_cmd_dst, migrate_capabilities=capabilities, diff --git a/qemu/tests/migration_with_file_transfer.py b/qemu/tests/migration_with_file_transfer.py index 279a6b6b98..da767b04c2 100644 --- a/qemu/tests/migration_with_file_transfer.py +++ b/qemu/tests/migration_with_file_transfer.py @@ -32,17 +32,17 @@ def run(test, params, env): host_path = "/tmp/file-%s" % utils_misc.generate_random_string(6) host_path_returned = "%s-returned" % host_path guest_path = params.get("guest_path", "/tmp/file") - file_size = params.get("file_size", "500") + file_size = params.get("file_size", "1000") transfer_timeout = int(params.get("transfer_timeout", "240")) if mig_protocol == "exec": mig_file = os.path.join( test.tmpdir, "tmp-%s" % utils_misc.generate_random_string(8) ) - + cnt = 0 try: - process.run("dd if=/dev/urandom of=%s bs=1M count=%s" % (host_path, file_size)) + process.run("dd if=/dev/zero of=%s bs=1M count=%s" % (host_path, file_size)) - def run_and_migrate(bg): + def run_and_migrate(bg, cnt): bg.start() try: while bg.is_alive(): @@ -54,14 +54,20 @@ def run_and_migrate(bg): if mig_protocol == "exec" and migration_exec_cmd_src: migration_exec_cmd_src %= mig_file # pylint: disable=E0606 migration_exec_cmd_dst %= mig_file + if cnt % 2 == 0: + dest_host = params.get("mig_dest_node") + else: + dest_host = params.get("vm_node") vm.migrate( mig_timeout, mig_protocol, mig_cancel_delay, + dest_host=dest_host, env=env, migration_exec_cmd_src=migration_exec_cmd_src, migration_exec_cmd_dst=migration_exec_cmd_dst, ) + cnt += 1 except Exception: # If something bad happened in the main thread, ignore # exceptions raised in the background thread @@ -69,6 +75,7 @@ def run_and_migrate(bg): raise else: bg.join() + return cnt error_context.context( "transferring file to guest while migrating", test.log.info @@ -78,7 +85,7 @@ def run_and_migrate(bg): (host_path, guest_path), dict(verbose=True, timeout=transfer_timeout), ) - run_and_migrate(bg) + cnt = run_and_migrate(bg, cnt) error_context.context( "transferring file back to host while migrating", test.log.info @@ -88,7 +95,7 @@ def run_and_migrate(bg): (guest_path, host_path_returned), dict(verbose=True, timeout=transfer_timeout), ) - run_and_migrate(bg) + run_and_migrate(bg, cnt) # Make sure the returned file is identical to the original one error_context.context("comparing hashes", test.log.info) diff --git a/qemu/tests/migration_with_netperf.py b/qemu/tests/migration_with_netperf.py index f952052825..6cf734821b 100644 --- a/qemu/tests/migration_with_netperf.py +++ b/qemu/tests/migration_with_netperf.py @@ -124,10 +124,20 @@ def run(test, params, env): m_count = 0 while netperf_client_h.is_netperf_running(): m_count += 1 + if m_count % 2 == 0: + dest_host = params.get("vm_node") + else: + dest_host = params.get("mig_dest_node") error_context.context( "Start migration iterations: %s " % m_count, test.log.info ) - vm.migrate(mig_timeout, mig_protocol, mig_cancel_delay, env=env) + vm.migrate( + mig_timeout, + mig_protocol, + mig_cancel_delay, + dest_host=dest_host, + env=env, + ) finally: if netperf_server_g: if netperf_server_g.is_server_running(): diff --git a/qemu/tests/migration_with_reboot.py b/qemu/tests/migration_with_reboot.py index 47d5342ca9..0f0a1fe889 100644 --- a/qemu/tests/migration_with_reboot.py +++ b/qemu/tests/migration_with_reboot.py @@ -48,15 +48,22 @@ def run(test, params, env): bg = utils_misc.InterruptedThread( vm.reboot, kwargs={"session": session, "timeout": login_timeout} ) + bg.daemon = True bg.start() try: + cnt = 0 while bg.is_alive(): for func in pre_migrate: func(vm, params, test) + if cnt % 2 == 0: + dest_host = params.get("mig_dest_node") + else: + dest_host = params.get("vm_node") vm.migrate( mig_timeout, mig_protocol, mig_cancel_delay, + dest_host=dest_host, env=env, migration_exec_cmd_src=migration_exec_cmd_src, migration_exec_cmd_dst=migration_exec_cmd_dst, @@ -64,6 +71,7 @@ def run(test, params, env): # run some functions after migrate finish. for func in post_migrate: func(vm, params, test) + cnt += 1 except Exception: # If something bad happened in the main thread, ignore exceptions # raised in the background thread diff --git a/qemu/tests/migration_with_speed_measurement.py b/qemu/tests/migration_with_speed_measurement.py index 1cd06c1891..c28cc28fcd 100644 --- a/qemu/tests/migration_with_speed_measurement.py +++ b/qemu/tests/migration_with_speed_measurement.py @@ -141,7 +141,11 @@ def get_migration_statistic(vm): time.sleep(2) clonevm = vm.migrate( - mig_timeout, mig_protocol, not_wait_for_migration=True, env=env + mig_timeout, + mig_protocol, + not_wait_for_migration=True, + dest_host=params.get("mig_dest_node"), + env=env, ) mig_speed = int(float(utils_misc.normalize_data_size(mig_speed, "M")))