From: Lucas Meneghel Rodrigues <lmr@redhat.com>
To: autotest@test.kernel.org
Cc: kvm@vger.kernel.org
Subject: [PATCH 2/5] KVM test: Unattended install Give Linux VMs time to shutdown cleanly v2
Date: Mon, 18 Apr 2011 19:40:42 -0300 [thread overview]
Message-ID: <1303166445-17898-3-git-send-email-lmr@redhat.com> (raw)
In-Reply-To: <1303166445-17898-1-git-send-email-lmr@redhat.com>
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(-)
diff --git a/client/tests/kvm/tests/unattended_install.py b/client/tests/kvm/tests/unattended_install.py
index 2d58cf2..fe7222e 100644
--- a/client/tests/kvm/tests/unattended_install.py
+++ b/client/tests/kvm/tests/unattended_install.py
@@ -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")
diff --git a/client/tests/kvm/tests_base.cfg.sample b/client/tests/kvm/tests_base.cfg.sample
index 6397590..b96755d 100644
--- a/client/tests/kvm/tests_base.cfg.sample
+++ b/client/tests/kvm/tests_base.cfg.sample
@@ -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
diff --git a/client/tests/kvm/unattended/Fedora-10.ks b/client/tests/kvm/unattended/Fedora-10.ks
index 5dffccd..081d41a 100644
--- a/client/tests/kvm/unattended/Fedora-10.ks
+++ b/client/tests/kvm/unattended/Fedora-10.ks
@@ -16,6 +16,7 @@ zerombr
clearpart --all --initlabel
autopart
reboot
+poweroff
%packages
@base
diff --git a/client/tests/kvm/unattended/Fedora-11.ks b/client/tests/kvm/unattended/Fedora-11.ks
index c7d43b3..c339220 100644
--- a/client/tests/kvm/unattended/Fedora-11.ks
+++ b/client/tests/kvm/unattended/Fedora-11.ks
@@ -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
diff --git a/client/tests/kvm/unattended/Fedora-12.ks b/client/tests/kvm/unattended/Fedora-12.ks
index c7d43b3..c339220 100644
--- a/client/tests/kvm/unattended/Fedora-12.ks
+++ b/client/tests/kvm/unattended/Fedora-12.ks
@@ -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
diff --git a/client/tests/kvm/unattended/Fedora-13.ks b/client/tests/kvm/unattended/Fedora-13.ks
index c7d43b3..c339220 100644
--- a/client/tests/kvm/unattended/Fedora-13.ks
+++ b/client/tests/kvm/unattended/Fedora-13.ks
@@ -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
diff --git a/client/tests/kvm/unattended/Fedora-14.ks b/client/tests/kvm/unattended/Fedora-14.ks
index db4298b..816428e 100644
--- a/client/tests/kvm/unattended/Fedora-14.ks
+++ b/client/tests/kvm/unattended/Fedora-14.ks
@@ -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
diff --git a/client/tests/kvm/unattended/Fedora-9.ks b/client/tests/kvm/unattended/Fedora-9.ks
index 9403191..a7d5399 100644
--- a/client/tests/kvm/unattended/Fedora-9.ks
+++ b/client/tests/kvm/unattended/Fedora-9.ks
@@ -16,6 +16,7 @@ zerombr
clearpart --all --initlabel
autopart
reboot
+poweroff
%packages
@base
diff --git a/client/tests/kvm/unattended/RHEL-4-series.ks b/client/tests/kvm/unattended/RHEL-4-series.ks
index 4583c76..2f7853e 100644
--- a/client/tests/kvm/unattended/RHEL-4-series.ks
+++ b/client/tests/kvm/unattended/RHEL-4-series.ks
@@ -15,7 +15,7 @@ bootloader --location=mbr --append="console=tty0 console=ttyS0,115200"
zerombr
clearpart --all --initlabel
autopart
-reboot
+poweroff
%packages
@ base
diff --git a/client/tests/kvm/unattended/RHEL-5-series.ks b/client/tests/kvm/unattended/RHEL-5-series.ks
index c528d8a..a7be569 100644
--- a/client/tests/kvm/unattended/RHEL-5-series.ks
+++ b/client/tests/kvm/unattended/RHEL-5-series.ks
@@ -15,7 +15,7 @@ bootloader --location=mbr --append="console=tty0 console=ttyS0,115200"
zerombr
clearpart --all --initlabel
autopart
-reboot
+poweroff
%packages
@base
diff --git a/client/tests/kvm/unattended/RHEL-6-series.ks b/client/tests/kvm/unattended/RHEL-6-series.ks
index 04f0672..fc41057 100644
--- a/client/tests/kvm/unattended/RHEL-6-series.ks
+++ b/client/tests/kvm/unattended/RHEL-6-series.ks
@@ -15,7 +15,7 @@ bootloader --location=mbr --append="console=tty0 console=ttyS0,115200"
zerombr
clearpart --all --initlabel
autopart
-reboot
+poweroff
%packages
@base
--
1.7.4.4
next prev parent reply other threads:[~2011-04-18 22:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-18 22:40 [PATCH 0/5] Make unattended install on Linux safer, fix OpenSUSE/SLES installs Lucas Meneghel Rodrigues
2011-04-18 22:40 ` [PATCH 1/5] KVM test: Fix incorrect CdromDisk instantiation when distro is OpenSUSE Lucas Meneghel Rodrigues
2011-04-18 22:40 ` Lucas Meneghel Rodrigues [this message]
2011-04-18 22:40 ` [PATCH 3/5] KVM test: unattended_install: Introduce wait_no_ack param Lucas Meneghel Rodrigues
2011-04-18 22:40 ` [PATCH 4/5] KVM test: Make OpenSUSE and SLES to use unattended_cdrom Lucas Meneghel Rodrigues
2011-04-18 22:40 ` [PATCH 5/5] KVM test: Introduce OpenSUSE 11.4 guest definitions Lucas Meneghel Rodrigues
2011-04-20 1:03 ` [PATCH 0/5] Make unattended install on Linux safer, fix OpenSUSE/SLES installs pradeep
2011-04-20 1:11 ` Lucas Meneghel Rodrigues
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1303166445-17898-3-git-send-email-lmr@redhat.com \
--to=lmr@redhat.com \
--cc=autotest@test.kernel.org \
--cc=kvm@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox