[PATCH 3/5] KVM test: unattended_install: Introduce wait_no_ack param

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux