Skip to content

Commit c799bf5

Browse files
hholoubkrh-jugraham
authored andcommitted
Improve test script so it will use in tls_reverse testcase specific machine_type.
The test was failing for aarch64 - as it need other machine type used in vm xml. as there was already similar approach for ppc64 machines, I've unified the way, how it is set.
1 parent fb4decf commit c799bf5

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

libvirt/tests/cfg/migration/migrate_vm.cfg

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,11 @@
208208
client_cn = "ENTER.YOUR.CLIENT_CN"
209209
extra_opt = "-c qemu+tls://${server_cn}/system"
210210
target_xml_path = "/tmp/avocado_vt_remote_vm1.xml"
211+
aarch64:
212+
specific_machine_type = "virt"
213+
ppc64:
214+
specific_machine_type = "pseries"
215+
211216
- bi_directional:
212217
virsh_options = "--live --p2p --verbose"
213218
migrate_vm_back = "yes"

libvirt/tests/src/migration/migrate_vm.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2434,14 +2434,14 @@ def get_target_hugepage_num(params):
24342434

24352435
try:
24362436
remote_virsh_session = virsh.VirshPersistent(**remote_virsh_dargs)
2437-
logging.debug("Check if remote guest exists")
2437+
logging.debug(f"TEST_STEP: Check if remote guest '{target_vm_name}' exists on '{server_ip}'")
24382438
if remote_virsh_session.domain_exists(target_vm_name) is False:
24392439
test.cancel("The guest '%s' on remote '%s' should be "
24402440
"installed before the test."
24412441
% (target_vm_name, server_ip))
24422442
# Check the prepared guest state on remote host.
24432443
# 'shut off' is expected.
2444-
logging.debug("Check if remote guest is in shutoff")
2444+
logging.debug(f"TEST_STEP: Check if remote guest is in shutoff.")
24452445
if remote_virsh_session.is_alive(target_vm_name):
24462446
test.error("The guest '%s' on remote "
24472447
"'%s' should not be alive."
@@ -2472,27 +2472,26 @@ def get_target_hugepage_num(params):
24722472
% (nfs_mount_dir, image_name)}
24732473
guest_config.sub(pattern2repl)
24742474

2475-
logging.debug("Modify remote guest xml's machine type")
24762475
arch = platform.machine()
2477-
if arch.count("ppc64"):
2478-
machine_type = "pseries"
2479-
2476+
specific_machine_type = params.get("specific_machine_type", machine_type)
2477+
logging.debug(f"TEST_STEP: Modify remote guest xml's machine type {specific_machine_type}")
24802478
pattern2repl = {r".*.machine=.*":
24812479
"<type arch='%s' machine='%s'>hvm</type>"
2482-
% (arch, machine_type)}
2480+
% (arch, specific_machine_type)}
2481+
logging.debug(f"Pattern to replace: {pattern2repl}")
24832482
guest_config.sub(pattern2repl)
24842483

24852484
# undefine remote guest
2486-
logging.debug("Undefine remote guest")
2485+
logging.debug(f"TEST_STEP: Undefine remote guest {target_vm_name}")
24872486
remote_virsh_session.undefine(target_vm_name, options="--nvram")
24882487

24892488
# redefine remote guest using updated XML
2490-
logging.debug("Redefine remote guest")
2489+
logging.debug("TEST_STEP: Redefine remote guest")
24912490
result = remote_virsh_session.define(xml_path)
2492-
logging.debug(result.stdout.strip())
2491+
logging.debug(f"result of redefine: {result}")
24932492

24942493
# start remote guest
2495-
logging.debug("Start remote guest")
2494+
logging.debug("TEST_STEP: Start remote guest")
24962495
remote_virsh_session.start(target_vm_name)
24972496

24982497
# dumpxml remote guest

0 commit comments

Comments
 (0)