@@ -558,7 +558,9 @@ def run_unattended_install(test, params, env):
logging.info("Guest reported successful installation after %d s (%d min)",
time_elapsed, time_elapsed/60)
- if post_install_delay:
- logging.debug("Post install delay specified, waiting %s s...",
- post_install_delay)
- time.sleep(post_install_delay)
+ if params.get("shutdown_cleanly", "yes") == "yes":
+ shutdown_cleanly_timeout = int(params.get("shutdown_cleanly_timeout",
+ 120))
+ logging.info("Wait for guest to shudown cleanly...")
+ if kvm_utils.wait_for(vm.is_dead, shutdown_cleanly_timeout, 1, 1):
+ logging.info("Guest managed to shutdown cleanly")
@@ -101,6 +101,8 @@ variants:
kill_vm = yes
kill_vm_gracefully = yes
kill_vm_on_error = yes
+ shutdown_cleanly = yes
+ shutdown_cleanly_timeout = 120
force_create_image = yes
extra_params += " -boot d"
guest_port_unattended_install = 12323
@@ -1294,7 +1296,6 @@ variants:
# hold your autoyast file
extra_params += " --append 'autoyast=floppy console=ttyS0,115200 console=tty0'"
#extra_params += " --append 'autoyast=cdrom console=ttyS0,115200 console=tty0'"
- post_install_delay = 10
variants:
- 11.0.32:
@@ -1434,7 +1435,6 @@ variants:
# hold your autoyast file
extra_params += " --append 'autoyast=floppy console=ttyS0,115200 console=tty0'"
#extra_params += " --append 'autoyast=cdrom console=ttyS0,115200 console=tty0'"
- post_install_delay = 10
kernel = linux
initrd = initrd
@@ -1563,6 +1563,8 @@ variants:
cdrom_unattended = images/rhel39-32/ks.iso
kernel = images/rhel39-32/vmlinuz
initrd = images/rhel39-32/initrd.img
+ # 3.X anaconda does not support 'poweroff' on ks
+ shutdown_cleanly = no
unattended_install.cdrom:
cdrom_cd1 = isos/linux/RHEL-3.9-i386-DVD.iso
md5sum_cd1 = ddd11a1cb104119039b0fa05df6d52b8
@@ -1583,6 +1585,8 @@ variants:
cdrom_unattended = images/rhel39-64/ks.iso
kernel = images/rhel39-64/vmlinuz
initrd = images/rhel39-64/initrd.img
+ # 3.X anaconda does not support 'poweroff' on ks
+ shutdown_cleanly = no
unattended_install.cdrom:
cdrom_cd1 = isos/linux/RHEL-3.9-x86_64-DVD.iso
md5sum_cd1 = bf4635e4a4bd3b43838e72bc8c329d55
@@ -16,6 +16,7 @@ zerombr
clearpart --all --initlabel
autopart
reboot
+poweroff
%packages
@base
@@ -12,6 +12,7 @@ timezone --utc America/New_York
firstboot --disable
bootloader --location=mbr --append="console=tty0 console=ttyS0,115200"
zerombr
+poweroff
clearpart --all --initlabel
autopart
@@ -12,6 +12,7 @@ timezone --utc America/New_York
firstboot --disable
bootloader --location=mbr --append="console=tty0 console=ttyS0,115200"
zerombr
+poweroff
clearpart --all --initlabel
autopart
@@ -12,6 +12,7 @@ timezone --utc America/New_York
firstboot --disable
bootloader --location=mbr --append="console=tty0 console=ttyS0,115200"
zerombr
+poweroff
clearpart --all --initlabel
autopart
@@ -12,6 +12,7 @@ timezone --utc America/New_York
firstboot --disable
bootloader --location=mbr --append="rd_NO_PLYMOUTH console=tty0 console=ttyS0,115200"
zerombr
+poweroff
clearpart --all --initlabel
autopart
@@ -16,6 +16,7 @@ zerombr
clearpart --all --initlabel
autopart
reboot
+poweroff
%packages
@base
@@ -15,7 +15,7 @@ bootloader --location=mbr --append="console=tty0 console=ttyS0,115200"
zerombr
clearpart --all --initlabel
autopart
-reboot
+poweroff
%packages
@ base
@@ -15,7 +15,7 @@ bootloader --location=mbr --append="console=tty0 console=ttyS0,115200"
zerombr
clearpart --all --initlabel
autopart
-reboot
+poweroff
%packages
@base
@@ -15,7 +15,7 @@ bootloader --location=mbr --append="console=tty0 console=ttyS0,115200"
zerombr
clearpart --all --initlabel
autopart
-reboot
+poweroff
%packages
@base
During unattended install, right after we receive the ACK from the guest the test is deemed to be finished, and as shutdown_vm = yes, it'll try to end the vm issuing a shutdown command to it. However, on virtually all Linux guests an SSH server is not available at the end of install, so KVM autotest will end the VM forcefully, which is not really safe, although it has served us well so far. We did not fix this 'problem' so far because on RHEL3, a supported guest, the anaconda syntax does not support the 'poweroff' directive, only 'reboot', so if we don't finish the VM right after the ACK from guest we really can't prevent it from starting the install again, getting an infinite loop. Well then, let's restrict this behavior only to RHEL 3, and fix this properly for all other systems, by introducing a 'shutdown_cleanly' param and setting it to 'yes' to everybody but RHEL 3. Windows doesn't need this at all, as when the ACK is received the system is fully booted up and functional, so the postprocessing will take care of shutting down the VM cleanly. I've fixed all Fedora and RHEL unattended files as part of this change. With this change, we can get rid of another parameter, post_install_delay, that was created with the only purpose of handling the fact that on autoyast install, when the ACK is sent to host, the system is not fully done with install. So we end up fixing yet another problem :) Changes from v1: * Properly convert the post ack timeout to an int * Don't fix SLES unattended files, they'll be fixed in posterior patches Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com> --- client/tests/kvm/tests/unattended_install.py | 10 ++++++---- client/tests/kvm/tests_base.cfg.sample | 8 ++++++-- client/tests/kvm/unattended/Fedora-10.ks | 1 + client/tests/kvm/unattended/Fedora-11.ks | 1 + client/tests/kvm/unattended/Fedora-12.ks | 1 + client/tests/kvm/unattended/Fedora-13.ks | 1 + client/tests/kvm/unattended/Fedora-14.ks | 1 + client/tests/kvm/unattended/Fedora-9.ks | 1 + client/tests/kvm/unattended/RHEL-4-series.ks | 2 +- client/tests/kvm/unattended/RHEL-5-series.ks | 2 +- client/tests/kvm/unattended/RHEL-6-series.ks | 2 +- 11 files changed, 21 insertions(+), 9 deletions(-)