From: Lucas Meneghel Rodrigues <lmr@redhat.com>
To: autotest@test.kernel.org
Cc: kvm@vger.kernel.org, ehabkost@redhat.com,
Lucas Meneghel Rodrigues <lmr@redhat.com>
Subject: [PATCH] KVM test: Unattended install - Give Linux VMs time to shutdown cleanly
Date: Tue, 12 Apr 2011 19:28:15 -0300 [thread overview]
Message-ID: <1302647295-24257-1-git-send-email-lmr@redhat.com> (raw)
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, RHEL, OpenSUSE, and SLES 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 :)
I've fixed the autoyast files exactly as the documentation [1] says, but
couldn't test OpenSUSE 11.2 because no matter how much I tried OpenSUSE
kernel panics under both F15 qemu-kvm and upstream qemu-kvm, and I don't
have access to SLES. IBM guys, please help! :)
[1] http://www.suse.de/~ug/autoyast_doc/configuration.html
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/OpenSUSE-11.xml | 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 +-
client/tests/kvm/unattended/SLES-11.xml | 1 +
13 files changed, 23 insertions(+), 9 deletions(-)
diff --git a/client/tests/kvm/tests/unattended_install.py b/client/tests/kvm/tests/unattended_install.py
index 40adfb9..41faeb5 100644
--- a/client/tests/kvm/tests/unattended_install.py
+++ b/client/tests/kvm/tests/unattended_install.py
@@ -553,7 +553,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 = 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 9d05364..64f6a7e 100644
--- a/client/tests/kvm/tests_base.cfg.sample
+++ b/client/tests/kvm/tests_base.cfg.sample
@@ -125,6 +125,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
@@ -1321,7 +1323,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:
@@ -1461,7 +1462,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
@@ -1590,6 +1590,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
@@ -1610,6 +1612,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/OpenSUSE-11.xml b/client/tests/kvm/unattended/OpenSUSE-11.xml
index 0ade836..95823cb 100644
--- a/client/tests/kvm/unattended/OpenSUSE-11.xml
+++ b/client/tests/kvm/unattended/OpenSUSE-11.xml
@@ -65,6 +65,7 @@
<ask-list config:type="list"/>
<mode>
<confirm config:type="boolean">false</confirm>
+ <final_halt config:type="boolean">true</final_halt>
</mode>
<mouse>
<id>none</id>
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
diff --git a/client/tests/kvm/unattended/SLES-11.xml b/client/tests/kvm/unattended/SLES-11.xml
index c694a31..deba4f6 100644
--- a/client/tests/kvm/unattended/SLES-11.xml
+++ b/client/tests/kvm/unattended/SLES-11.xml
@@ -92,6 +92,7 @@
<ask-list config:type="list"/>
<mode>
<confirm config:type="boolean">false</confirm>
+ <final_halt config:type="boolean">true</final_halt>
</mode>
<mouse>
<id>none</id>
--
1.7.4.2
next reply other threads:[~2011-04-12 22:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-12 22:28 Lucas Meneghel Rodrigues [this message]
2011-04-13 16:16 ` [PATCH] KVM test: Unattended install - Give Linux VMs time to shutdown cleanly Eduardo Habkost
2011-04-13 16:35 ` 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=1302647295-24257-1-git-send-email-lmr@redhat.com \
--to=lmr@redhat.com \
--cc=autotest@test.kernel.org \
--cc=ehabkost@redhat.com \
--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