public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Lucas Meneghel Rodrigues <lmr@redhat.com>
To: autotest@test.kernel.org
Cc: kvm@vger.kernel.org
Subject: [PATCH 3/5] KVM test: unattended_install: Introduce wait_no_ack param
Date: Mon, 18 Apr 2011 19:40:43 -0300	[thread overview]
Message-ID: <1303166445-17898-4-git-send-email-lmr@redhat.com> (raw)
In-Reply-To: <1303166445-17898-1-git-send-email-lmr@redhat.com>

Some distros such as OpenSUSE won't let the install test to
communicate the guest ACK for some weird reason [1], this commit
modifies the unattended_install test introducing a wait_no_ack
param that will skip the ACK check, and break the unattended
install loop when the machine turns off itself (directive halt
on OpenSUSE and SLES unattended file).

Other distros shouldn't be affected by this change, their
install behavior was kept the same.

[1] Tried several ways of transmitting the ACK by means of chroot
scripts, no way. In the end of the day, I was short on time to
spend too much of it figuring out a way to do it, hence the
wait_no_ack param was born. I really could use some help from the
guys that introduced OpenSUSE and SLES support to kvm autotest.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
---
 client/tests/kvm/tests/unattended_install.py |   25 +++++++++++++++++--------
 client/tests/kvm/tests_base.cfg.sample       |    2 ++
 client/tests/kvm/unattended/OpenSUSE-11.xml  |   13 ++-----------
 client/tests/kvm/unattended/SLES-11.xml      |   13 ++-----------
 4 files changed, 23 insertions(+), 30 deletions(-)

diff --git a/client/tests/kvm/tests/unattended_install.py b/client/tests/kvm/tests/unattended_install.py
index fe7222e..8513e0b 100644
--- a/client/tests/kvm/tests/unattended_install.py
+++ b/client/tests/kvm/tests/unattended_install.py
@@ -526,15 +526,23 @@ def run_unattended_install(test, params, env):
 
     start_time = time.time()
     while (time.time() - start_time) < install_timeout:
-        vm.verify_alive()
-        vm.verify_kernel_crash()
-        client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
         try:
-            client.connect((vm.get_address(), port))
-            if client.recv(1024) == "done":
+            vm.verify_alive()
+        except kvm_vm.VMDeadError, e:
+            if params.get("wait_no_ack", "no") == "yes":
                 break
-        except (socket.error, kvm_vm.VMAddressError):
-            pass
+            else:
+                raise e
+        vm.verify_kernel_crash()
+        if params.get("wait_no_ack", "no") == "no":
+            client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+            try:
+                client.connect((vm.get_address(), port))
+                if client.recv(1024) == "done":
+                    break
+            except (socket.error, kvm_vm.VMAddressError):
+                pass
+
         if migrate_background:
             # Drop the params which may break the migration
             # Better method is to use dnsmasq to do the
@@ -549,7 +557,8 @@ def run_unattended_install(test, params, env):
             vm.migrate(timeout=mig_timeout, protocol=mig_protocol)
         else:
             time.sleep(1)
-        client.close()
+        if params.get("wait_no_ack", "no") == "no":
+            client.close()
     else:
         raise error.TestFail("Timeout elapsed while waiting for install to "
                              "finish")
diff --git a/client/tests/kvm/tests_base.cfg.sample b/client/tests/kvm/tests_base.cfg.sample
index b96755d..fbe416e 100644
--- a/client/tests/kvm/tests_base.cfg.sample
+++ b/client/tests/kvm/tests_base.cfg.sample
@@ -1296,6 +1296,7 @@ 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'"
+                    wait_no_ack = yes
 
                 variants:
                     - 11.0.32:
@@ -1437,6 +1438,7 @@ variants:
                     #extra_params += " --append 'autoyast=cdrom console=ttyS0,115200 console=tty0'"
                     kernel = linux
                     initrd = initrd
+                    wait_no_ack = yes
 
                 variants:
                     - 11.0.32:
diff --git a/client/tests/kvm/unattended/OpenSUSE-11.xml b/client/tests/kvm/unattended/OpenSUSE-11.xml
index 0ade836..0f11ac9 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>
+      <halt config:type="boolean">true</halt>
     </mode>
     <mouse>
       <id>none</id>
@@ -160,17 +161,7 @@
         <source><![CDATA[dhclient eth0
 chkconfig sshd on
 sed -i -e 's/\(PasswordAuthentication\s\)no/\1yes/g'  /etc/ssh/sshd_config
-cat <<EOF>server
-#!/usr/bin/python
-import socket, os
-server=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-server.bind(('',12323))
-server.listen(1)
-(client, addr) = server.accept()
-client.send("done")
-client.close()
-EOF
-python server
+service sshd restart
 ]]></source>
       </script>
     </init-scripts>
diff --git a/client/tests/kvm/unattended/SLES-11.xml b/client/tests/kvm/unattended/SLES-11.xml
index c694a31..16c25d0 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>
+      <halt config:type="boolean">true</halt>
     </mode>
     <mouse>
       <id>none</id>
@@ -542,17 +543,7 @@
         <source><![CDATA[dhclient eth0
 chkconfig sshd on
 sed -i -e 's/\(PasswordAuthentication\s\)no/\1yes/g'  /etc/ssh/sshd_config
-cat <<EOF>server
-#!/usr/bin/python
-import socket, os
-server=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-server.bind(('',12323))
-server.listen(1)
-(client, addr) = server.accept()
-client.send("done")
-client.close()
-EOF
-python server
+service sshd restart
 ]]></source>
       </script>
     </init-scripts>
-- 
1.7.4.4

  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 ` [PATCH 2/5] KVM test: Unattended install Give Linux VMs time to shutdown cleanly v2 Lucas Meneghel Rodrigues
2011-04-18 22:40 ` Lucas Meneghel Rodrigues [this message]
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-4-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