From 791e16c2587b6857324c6f4efcfd5256aa0b2548 Mon Sep 17 00:00:00 2001 From: Yalan Zhang Date: Fri, 13 Dec 2024 02:25:57 -0500 Subject: [PATCH] Update the expectation for libvirt_guests If there is no "on_boot" setting in libvirt_guests.conf, the behavior will be the same with "on_boot=start" for running VM. Refer to libvirt.org: "By default, libvirt-guests will suspend running guests when the host shuts down, and restore them to their pre-shutdown state when the host reboots." Signed-off-by: Yalan Zhang --- .../sysconfig_libvirt_guests/libvirt_guests.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/libvirt/tests/src/daemon/conf_file/sysconfig_libvirt_guests/libvirt_guests.py b/libvirt/tests/src/daemon/conf_file/sysconfig_libvirt_guests/libvirt_guests.py index 995f592aa1..77a3221251 100644 --- a/libvirt/tests/src/daemon/conf_file/sysconfig_libvirt_guests/libvirt_guests.py +++ b/libvirt/tests/src/daemon/conf_file/sysconfig_libvirt_guests/libvirt_guests.py @@ -93,11 +93,11 @@ def chk_on_boot(status_error, on_boot): :param status_error: positive test if status_error is "no", otherwise negative test - :param on_boot: action taking on host booting + :param on_boot: action taking on host booting which set in the conf file """ if status_error == "no": - if on_boot == "start" or transient_vm: - for dom in vms: + if on_boot != "ignore": + for dom in active_vms: if not dom.is_alive(): test.fail("guest:%s should be running after " "restarting libvirt-guests." % dom.name) @@ -353,6 +353,11 @@ def transfer_to_transient(per_guest_name): process.run("cat /etc/sysconfig/libvirt-guests", shell=True) tail_messages = get_log() + # Before restart libvirt-guests, check the status of all VMs + active_vms = [] + for dom in vms: + if dom.is_alive: + active_vms.append(dom) # Even though libvirt-guests was designed to operate guests when # host shutdown. The purpose can also be fulfilled by restart the # libvirt-guests service. @@ -368,7 +373,7 @@ def transfer_to_transient(per_guest_name): virsh.dom_list("--all", debug=True) if not (transient_vm and on_shutdown == "shutdown"): # check the guests state when host rebooted - chk_on_boot(status_error, on_boot) + chk_on_boot(status_error, on_boot, active_vms) # check the guests save files chk_save_files(status_error, on_shutdown, on_boot)