diff mbox

KVM test: Parallel install of guest OS v3

Message ID 1268879338-12112-1-git-send-email-lmr@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Lucas Meneghel Rodrigues March 18, 2010, 2:28 a.m. UTC
None
diff mbox

Patch

diff --git a/client/tests/kvm/deps/finish.cpp b/client/tests/kvm/deps/finish.cpp
index 9c2867c..e5ba128 100644
--- a/client/tests/kvm/deps/finish.cpp
+++ b/client/tests/kvm/deps/finish.cpp
@@ -1,12 +1,13 @@ 
-// Simple app that only sends an ack string to the KVM unattended install
-// watch code.
+// Simple application that creates a server socket, listening for connections
+// of the unattended install test. Once it gets a client connected, the
+// app will send back an ACK string, indicating the install process is done.
 //
 // You must link this code with Ws2_32.lib, Mswsock.lib, and Advapi32.lib
 //
 // Author: Lucas Meneghel Rodrigues <lmr@redhat.com>
 // Code was adapted from an MSDN sample.
 
-// Usage: finish.exe [Host OS IP]
+// Usage: finish.exe
 
 // MinGW's ws2tcpip.h only defines getaddrinfo and other functions only for
 // the case _WIN32_WINNT >= 0x0501.
@@ -21,24 +22,18 @@ 
 #include <stdlib.h>
 #include <stdio.h>
 
-#define DEFAULT_BUFLEN 512
 #define DEFAULT_PORT "12323"
-
 int main(int argc, char **argv)
 {
     WSADATA wsaData;
-    SOCKET ConnectSocket = INVALID_SOCKET;
-    struct addrinfo *result = NULL,
-                    *ptr = NULL,
-                    hints;
+    SOCKET ListenSocket = INVALID_SOCKET, ClientSocket = INVALID_SOCKET;
+    struct addrinfo *result = NULL, hints;
     char *sendbuf = "done";
-    char recvbuf[DEFAULT_BUFLEN];
-    int iResult;
-    int recvbuflen = DEFAULT_BUFLEN;
+    int iResult, iSendResult;
 
     // Validate the parameters
-    if (argc != 2) {
-        printf("usage: %s server-name\n", argv[0]);
+    if (argc != 1) {
+        printf("usage: %s", argv[0]);
         return 1;
     }
 
@@ -49,72 +44,84 @@  int main(int argc, char **argv)
         return 1;
     }
 
-    ZeroMemory( &hints, sizeof(hints) );
-    hints.ai_family = AF_UNSPEC;
+    ZeroMemory(&hints, sizeof(hints));
+    hints.ai_family = AF_INET;
     hints.ai_socktype = SOCK_STREAM;
     hints.ai_protocol = IPPROTO_TCP;
+    hints.ai_flags = AI_PASSIVE;
 
     // Resolve the server address and port
-    iResult = getaddrinfo(argv[1], DEFAULT_PORT, &hints, &result);
-    if ( iResult != 0 ) {
+    iResult = getaddrinfo(NULL, DEFAULT_PORT, &hints, &result);
+    if (iResult != 0) {
         printf("getaddrinfo failed: %d\n", iResult);
         WSACleanup();
         return 1;
     }
 
-    // Attempt to connect to an address until one succeeds
-    for(ptr=result; ptr != NULL ;ptr=ptr->ai_next) {
-
-        // Create a SOCKET for connecting to server
-        ConnectSocket = socket(ptr->ai_family, ptr->ai_socktype,
-            ptr->ai_protocol);
-        if (ConnectSocket == INVALID_SOCKET) {
-            printf("Error at socket(): %ld\n", WSAGetLastError());
-            freeaddrinfo(result);
-            WSACleanup();
-            return 1;
-        }
-
-        // Connect to server.
-        iResult = connect( ConnectSocket, ptr->ai_addr, (int)ptr->ai_addrlen);
-        if (iResult == SOCKET_ERROR) {
-            closesocket(ConnectSocket);
-            ConnectSocket = INVALID_SOCKET;
-            continue;
-        }
-        break;
+    // Create a SOCKET for connecting to server
+    ListenSocket = socket(result->ai_family, result->ai_socktype,
+                          result->ai_protocol);
+    if (ListenSocket == INVALID_SOCKET) {
+        printf("socket failed: %ld\n", WSAGetLastError());
+        freeaddrinfo(result);
+        WSACleanup();
+        return 1;
+    }
+
+    // Setup the TCP listening socket
+    iResult = bind(ListenSocket, result->ai_addr, (int)result->ai_addrlen);
+    if (iResult == SOCKET_ERROR) {
+        printf("bind failed: %d\n", WSAGetLastError());
+        freeaddrinfo(result);
+        closesocket(ListenSocket);
+        WSACleanup();
+        return 1;
     }
 
     freeaddrinfo(result);
 
-    if (ConnectSocket == INVALID_SOCKET) {
-        printf("Unable to connect to server!\n");
+    iResult = listen(ListenSocket, SOMAXCONN);
+    if (iResult == SOCKET_ERROR) {
+        printf("listen failed: %d\n", WSAGetLastError());
+        closesocket(ListenSocket);
         WSACleanup();
         return 1;
     }
 
-    // Send the ACK buffer
-    iResult = send( ConnectSocket, sendbuf, (int)strlen(sendbuf), 0 );
-    if (iResult == SOCKET_ERROR) {
-        printf("send failed: %d\n", WSAGetLastError());
-        closesocket(ConnectSocket);
+    // Accept a client socket
+    ClientSocket = accept(ListenSocket, NULL, NULL);
+    if (ClientSocket == INVALID_SOCKET) {
+        printf("accept failed: %d\n", WSAGetLastError());
+        closesocket(ListenSocket);
         WSACleanup();
         return 1;
     }
 
-    printf("Bytes Sent: %ld\n", iResult);
+    // No longer need the server socket
+    closesocket(ListenSocket);
+
+    // Send the ack string to the client
+    iSendResult = send(ClientSocket, sendbuf, sizeof(sendbuf), 0);
+    if (iSendResult == SOCKET_ERROR) {
+        printf("send failed: %d\n", WSAGetLastError());
+        closesocket(ClientSocket);
+        WSACleanup();
+        return 1;
+    }
+    // Report the number of bytes sent
+    printf("Bytes sent: %d\n", iSendResult);
 
-    // shutdown the connection since no more data will be sent
-    iResult = shutdown(ConnectSocket, SD_SEND);
+    // Shutdown the connection since we're done
+    iResult = shutdown(ClientSocket, SD_SEND);
     if (iResult == SOCKET_ERROR) {
         printf("shutdown failed: %d\n", WSAGetLastError());
-        closesocket(ConnectSocket);
+        closesocket(ClientSocket);
         WSACleanup();
         return 1;
     }
 
-    // cleanup
-    closesocket(ConnectSocket);
+    // Cleanup
+    closesocket(ClientSocket);
     WSACleanup();
 
     return 0;
diff --git a/client/tests/kvm/deps/finish.exe b/client/tests/kvm/deps/finish.exe
index 5387780fd769fe574ef5c4cc93e57fece35d2132..59792973aea6e405d725371c077d032e2aa936b1 100755
GIT binary patch
delta 4604
zcmb7HeNa@_6~FJXux}A@D`3Enbd}YjvAS5GR7F?VEvo@t1g-TW8)O$*zC>A~$)KBL
zr7hi(!Q7^`iOpb=I-SPBR;I0;b`nNRHIt4tPCu-+kyuQhm9c9}6Eim1{?2=E_wmYK
zy)$p`dB6KRz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 def find_free_port(start_port, end_port):
     """
-    Return a free port in the range [start_port, end_port).
+    Return a host free port in the range [start_port, end_port].
 
     @param start_port: First port that will be checked.
     @param end_port: Port immediately after the last one that will be checked.
@@ -648,7 +648,7 @@  def find_free_port(start_port, end_port):
 
 def find_free_ports(start_port, end_port, count):
     """
-    Return count free ports in the range [start_port, end_port).
+    Return count of host free ports in the range [start_port, end_port].
 
     @count: Initial number of ports known to be free in the range.
     @param start_port: First port that will be checked.
diff --git a/client/tests/kvm/scripts/unattended.py b/client/tests/kvm/scripts/unattended.py
index 343f955..b02e495 100755
--- a/client/tests/kvm/scripts/unattended.py
+++ b/client/tests/kvm/scripts/unattended.py
@@ -31,35 +31,34 @@  class UnattendedInstall(object):
         self.deps_dir = os.path.join(kvm_test_dir, 'deps')
         self.unattended_dir = os.path.join(kvm_test_dir, 'unattended')
 
-        try:
-            tftp_root = os.environ['KVM_TEST_tftp']
+        tftp_root = os.environ.get('KVM_TEST_tftp', '')
+        if tftp_root:
             self.tftp_root = os.path.join(kvm_test_dir, tftp_root)
             if not os.path.isdir(self.tftp_root):
                 os.makedirs(self.tftp_root)
-        except KeyError:
-            self.tftp_root = ''
-
-        try:
-            self.kernel_args = os.environ['KVM_TEST_kernel_args']
-        except KeyError:
-            self.kernel_args = ''
-
-        try:
-            self.finish_program= os.environ['KVM_TEST_finish_program']
-        except:
-            self.finish_program = None
-
+        else:
+            self.tftp_root = tftp_root
 
-        cdrom_iso = os.environ['KVM_TEST_cdrom']
-        self.unattended_file = os.environ['KVM_TEST_unattended_file']
+        self.kernel_args = os.environ.get('KVM_TEST_kernel_args', '')
+        self.finish_program= os.environ.get('KVM_TEST_finish_program', '')
+        cdrom_iso = os.environ.get('KVM_TEST_cdrom')
+        self.unattended_file = os.environ.get('KVM_TEST_unattended_file')
 
-        self.qemu_img_bin = os.environ['KVM_TEST_qemu_img_binary']
+        self.qemu_img_bin = os.environ.get('KVM_TEST_qemu_img_binary')
         if not os.path.isabs(self.qemu_img_bin):
             self.qemu_img_bin = os.path.join(kvm_test_dir, self.qemu_img_bin)
         self.cdrom_iso = os.path.join(kvm_test_dir, cdrom_iso)
         self.floppy_mount = tempfile.mkdtemp(prefix='floppy_', dir='/tmp')
         self.cdrom_mount = tempfile.mkdtemp(prefix='cdrom_', dir='/tmp')
-        self.floppy_img = os.path.join(images_dir, 'floppy.img')
+        flopy_name = os.environ['KVM_TEST_floppy']
+        self.floppy_img = os.path.join(kvm_test_dir, flopy_name)
+        floppy_dir = os.path.dirname(self.floppy_img)
+        if not os.path.isdir(floppy_dir):
+            os.makedirs(floppy_dir)
+
+        self.pxe_dir = os.environ.get('KVM_TEST_pxe_dir', '')
+        self.pxe_image = os.environ.get('KVM_TEST_pxe_image', '')
+        self.pxe_initrd = os.environ.get('KVM_TEST_pxe_initrd', '')
 
 
     def create_boot_floppy(self):
@@ -94,9 +93,15 @@  class UnattendedInstall(object):
                 setup_file_dest = os.path.join(self.floppy_mount, setup_file)
                 shutil.copyfile(setup_file_path, setup_file_dest)
             elif self.unattended_file.endswith('.ks'):
+                # Red Hat kickstart install
                 dest_fname = 'ks.cfg'
             elif self.unattended_file.endswith('.xml'):
-                dest_fname = "autounattend.xml"
+                if  self.tftp_root is '':
+                    # Windows unattended install
+                    dest_fname = "autounattend.xml"
+                else:
+                    # SUSE autoyast install
+                    dest_fname = "autoinst.xml"
 
             dest = os.path.join(self.floppy_mount, dest_fname)
 
@@ -166,21 +171,20 @@  class UnattendedInstall(object):
                 raise SetupError('Could not mount CD image %s.' %
                                  self.cdrom_iso)
 
-            p = os.path.join('images', 'pxeboot')
-            pxe_dir = os.path.join(self.cdrom_mount, p)
-            pxe_image = os.path.join(pxe_dir, 'vmlinuz')
-            pxe_initrd = os.path.join(pxe_dir, 'initrd.img')
+            pxe_dir = os.path.join(self.cdrom_mount, self.pxe_dir)
+            pxe_image = os.path.join(pxe_dir, self.pxe_image)
+            pxe_initrd = os.path.join(pxe_dir, self.pxe_initrd)
 
             if not os.path.isdir(pxe_dir):
                 raise SetupError('The ISO image does not have a %s dir. The '
                                  'script assumes that the cd has a %s dir '
                                  'where to search for the vmlinuz image.' %
-                                 (p, p))
+                                 (self.pxe_dir, self.pxe_dir))
 
             if not os.path.isfile(pxe_image) or not os.path.isfile(pxe_initrd):
                 raise SetupError('The location %s is lacking either a vmlinuz '
                                  'or a initrd.img file. Cannot find a PXE '
-                                 'image to proceed.' % pxe_dir)
+                                 'image to proceed.' % self.pxe_dir)
 
             tftp_image = os.path.join(self.tftp_root, 'vmlinuz')
             tftp_initrd = os.path.join(self.tftp_root, 'initrd.img')
@@ -239,6 +243,9 @@  class UnattendedInstall(object):
         print "    floppy_mount: " + str(self.floppy_mount)
         print "    floppy_img: " + str(self.floppy_img)
         print "    finish_program: " + str(self.finish_program)
+        print "    pxe_dir: " + str(self.pxe_dir)
+        print "    pxe_image: " + str(self.pxe_image)
+        print "    pxe_initrd: " + str(self.pxe_initrd)
 
         self.create_boot_floppy()
         if self.tftp_root:
diff --git a/client/tests/kvm/tests/unattended_install.py b/client/tests/kvm/tests/unattended_install.py
index e3df72a..1ddb996 100644
--- a/client/tests/kvm/tests/unattended_install.py
+++ b/client/tests/kvm/tests/unattended_install.py
@@ -13,34 +13,35 @@  def run_unattended_install(test, params, env):
     @param params: Dictionary with the test parameters.
     @param env: Dictionary with test environment.
     """
+    buf = 1024
     vm = kvm_test_utils.get_living_vm(env, params.get("main_vm"))
 
-    server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-    server.bind(('', 12323))
-    server.listen(1)
+    port = vm.get_port(int(params.get("guest_port_unattended_install")))
+    addr = ('localhost', port)
 
     install_timeout = float(params.get("timeout", 3000))
     logging.info("Starting unattended install watch process. "
                  "Timeout set to %ds (%d min)", install_timeout,
                  install_timeout/60)
     start_time = time.time()
-
-    while True:
-        server.settimeout(install_timeout)
+    time_elapsed = 0
+    while time_elapsed < install_timeout:
+        client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
         try:
-            (client, addr) = server.accept()
-        except socket.timeout:
-            server.close()
-            raise error.TestFail('Timeout elapsed while waiting for install to '
-                                 'finish.')
-        msg = client.recv(1024)
-        logging.debug("Received '%s' from %s", msg, addr)
-        if msg == 'done':
-            end_time = time.time()
-            time_elapsed = int(end_time - start_time)
-            logging.info('Guest reported successful installation after %ds '
-                         '(%d min)', time_elapsed, time_elapsed/60)
-            server.close()
-            break
-        else:
-            logging.error('Got invalid string from client: %s.' % msg)
+            client.connect(addr)
+            msg = client.recv(1024)
+            if msg == 'done':
+                break
+        except socket.error:
+            pass
+        time.sleep(1)
+        client.close()
+        end_time = time.time()
+        time_elapsed = int(end_time - start_time)
+
+    if time_elapsed < install_timeout:
+        logging.info('Guest reported successful installation after %ds '
+                     '(%d min)', time_elapsed, time_elapsed/60)
+    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 beae786..ce3a553 100644
--- a/client/tests/kvm/tests_base.cfg.sample
+++ b/client/tests/kvm/tests_base.cfg.sample
@@ -70,6 +70,8 @@  variants:
         floppy = "images/floppy.img"
         extra_params += " -boot d"
         nic_mode = user
+        redirs += " unattended_install"
+        guest_port_unattended_install = 12323
 
     - boot:         install setup unattended_install
         type = boot
@@ -337,6 +339,9 @@  variants:
                 no setup
                 shell_prompt = "^\[.*\][\#\$]\s*$"
                 unattended_install:
+                    pxe_dir = "images/pxeboot"
+                    pxe_image = "vmlinuz"
+                    pxe_initrd = "initrd.img"
                     tftp = "images/tftpboot"
                     extra_params += " -bootp /pxelinux.0 -boot n"
                     kernel_args = "ks=floppy nicdelay=60"
@@ -352,10 +357,12 @@  variants:
                             steps = Fedora-8-i386.steps
                         unattended_install:
                             unattended_file = unattended/Fedora-8.ks
+                            tftp = images/f8-32/tftpboot
+                            floppy = images/f8-32/floppy.img
 
                     - 8.64:
                         no setup
-                        image_name = fc8-64
+                        image_name = f8-64
                         cdrom = linux/Fedora-8-x86_64-DVD.iso
                         md5sum = 2cb231a86709dec413425fd2f8bf5295
                         md5sum_1m = 145f6414e19492649a56c89f0a45e719
@@ -363,9 +370,11 @@  variants:
                             steps = Fedora-8-64.steps
                         unattended_install:
                             unattended_file = unattended/Fedora-8.ks
+                            tftp = images/f8-64/tftpboot
+                            floppy = images/f8-64/floppy.img
 
                     - 9.32:
-                        image_name = fc9-32
+                        image_name = f9-32
                         cdrom = linux/Fedora-9-i386-DVD.iso
                         md5sum = 72601f685ea8c808c303353d8bf4d307
                         md5sum_1m = f24fa25689e5863f1b99984c6feb787f
@@ -373,9 +382,11 @@  variants:
                             steps = Fedora-9-i386.steps
                         unattended_install:
                             unattended_file = unattended/Fedora-9.ks
+                            tftp = images/f9-32/tftpboot
+                            floppy = images/f9-32/floppy.img
 
                     - 9.64:
-                        image_name = fc9-64
+                        image_name = f9-64
                         cdrom = linux/Fedora-9-x86_64-DVD.iso
                         md5sum = 05b2ebeed273ec54d6f9ed3d61ea4c96
                         md5sum_1m = 9822ab5097e37e8fe306ef2192727db4
@@ -383,25 +394,31 @@  variants:
                             steps = Fedora-9-64.steps
                         unattended_install:
                             unattended_file = unattended/Fedora-9.ks
+                            tftp = images/f9-64/tftpboot
+                            floppy = images/f9-64/floppy.img
 
                     - 10.32:
-                        image_name = fc10-32
+                        image_name = f10-32
                         cdrom = linux/Fedora-10-i386-DVD.iso
                         md5sum = 27e581edb392728c4a07d00d3fc5ced0
                         md5sum_1m = bd67c68bdf595e4ba7131ec702159181
                         unattended_install:
                             unattended_file = unattended/Fedora-10.ks
+                            tftp = images/f10-32/tftpboot
+                            floppy = images/f10-32/floppy.img
 
                     - 10.64:
-                        image_name = fc10-64
+                        image_name = f10-64
                         cdrom = linux/Fedora-10-x86_64-DVD.iso
                         sha1sum = f1e5ae7db6a1ba227de7294c4112385922388648
                         md5sum_1m = 732857cbf40c80c34683e874601d982c
                         unattended_install:
                             unattended_file = unattended/Fedora-10.ks
+                            tftp = images/f10-64/tftpboot
+                            floppy = images/f10-64/floppy.img
 
                     - 11.32:
-                        image_name = fc11-32
+                        image_name = f11-32
                         cdrom = linux/Fedora-11-i386-DVD.iso
                         md5sum = e3b1e2d1ba42aa4705fa5f41771b3927
                         md5sum_1m = dc8ddf90648c247339c721395aa49714
@@ -409,30 +426,38 @@  variants:
                             steps = Fedora-11-32.steps
                         unattended_install:
                             unattended_file = unattended/Fedora-11.ks
+                            tftp = images/f11-32/tftpboot
+                            floppy = images/f11-32/floppy.img
 
                     - 11.64:
-                        image_name = fc11-64
+                        image_name = f11-64
                         cdrom = linux/Fedora-11-x86_64-DVD.iso
                         md5sum = 9d419844adeb93120215fe7505c9bce8
                         md5sum_1m = 405ee05e2387a2e4328b008d5bcbdd1e
                         unattended_install:
                             unattended_file = unattended/Fedora-11.ks
+                            tftp = images/f11-64/tftpboot
+                            floppy = images/f11-64/floppy.img
 
                     - 12.32:
-                        image_name = fc12-32
+                        image_name = f12-32
                         cdrom = linux/Fedora-12-i386-DVD.iso
                         md5sum = 2c4c1c0d09f2fbcfd8ee6a0c5542eeb2
                         md5sum_1m = eee935d7f0cf2ef03f6ddce3a2a50050
                         unattended_install:
                             unattended_file = unattended/Fedora-12.ks
+                            tftp = images/f12-32/tftpboot
+                            floppy = images/f12-32/floppy.img
 
                     - 12.64:
-                        image_name = fc12-64
+                        image_name = f12-64
                         cdrom = linux/Fedora-12-x86_64-DVD.iso
                         md5sum = 6dd31e292cc2eb1140544e9b1ba61c56
                         md5sum_1m = 514efbd7698b55ff6768c8605438bfc5
                         unattended_install:
                             unattended_file = unattended/Fedora-12.ks
+                            tftp = images/f12-64/tftpboot
+                            floppy = images/f12-64/floppy.img
 
             - DSL-4.2.5:
                 no setup dbench bonnie linux_s3
@@ -517,6 +542,9 @@  variants:
                 block_hotplug:
                     modprobe_module = acpiphp
                 unattended_install:
+                    pxe_dir = "images/pxeboot"
+                    pxe_image = "vmlinuz"
+                    pxe_initrd = "initrd.img"
                     tftp = "images/tftpboot"
                     extra_params += " -bootp /pxelinux.0 -boot n"
                     kernel_args = "ks=floppy nicdelay=60"
@@ -533,6 +561,8 @@  variants:
                             steps=RHEL-3.9-i386.steps
                         unattended_install:
                             unattended_file = unattended/RHEL-3-series.ks
+                            tftp = images/rhel39-32/tftpboot
+                            floppy = images/rhel39-32/floppy.img
 
                     - 3.9.x86_64:
                         no setup autotest linux_s3
@@ -545,6 +575,8 @@  variants:
                             steps=RHEL-3.9-x86_64.steps
                         unattended_install:
                             unattended_file = unattended/RHEL-3-series.ks
+                            tftp = images/rhel39-64/tftpboot
+                            floppy = images/rhel39-64/floppy.img
 
                     - 4.7.i386:
                         no setup autotest
@@ -556,6 +588,8 @@  variants:
                             steps=RHEL-4.7-i386.steps
                         unattended_install:
                             unattended_file = unattended/RHEL-4-series.ks
+                            tftp = images/rhel47-32/tftpboot
+                            floppy = images/rhel47-32/floppy.img
 
                     - 4.7.x86_64:
                         no setup autotest
@@ -567,6 +601,8 @@  variants:
                             steps=RHEL-4.7-x86_64.steps
                         unattended_install:
                             unattended_file = unattended/RHEL-4-series.ks
+                            tftp = images/rhel47-64/tftpboot
+                            floppy = images/rhel47-64/floppy.img
 
                     - 4.8.i386:
                         no setup autotest
@@ -576,6 +612,8 @@  variants:
                         md5sum_1m = 969c197402b9058f28a278c1f807d15b
                         unattended_install:
                             unattended_file = unattended/RHEL-4-series.ks
+                            tftp = images/rhel48-32/tftpboot
+                            floppy = images/rhel48-32/floppy.img
 
                     - 4.8.x86_64:
                         no setup autotest
@@ -585,6 +623,8 @@  variants:
                         md5sum_1m = b11ac0ef7fd345ad712966972db63886
                         unattended_install:
                             unattended_file = unattended/RHEL-4-series.ks
+                            tftp = images/rhel48-64/tftpboot
+                            floppy = images/rhel48-64/floppy.img
 
                     - 5.3.i386:
                         no setup
@@ -596,6 +636,8 @@  variants:
                             steps=RHEL-5.3-i386.steps
                         unattended_install:
                             unattended_file = unattended/RHEL-5-series.ks
+                            tftp = images/rhel53-32/tftpboot
+                            floppy = images/rhel53-32/floppy.img
 
                     - 5.3.x86_64:
                         no setup
@@ -607,6 +649,8 @@  variants:
                             steps=RHEL-5.3-x86_64.steps
                         unattended_install:
                             unattended_file = unattended/RHEL-5-series.ks
+                            tftp = images/rhel53-64/tftpboot
+                            floppy = images/rhel53-64/floppy.img
 
                     - 5.4.i386:
                         no setup
@@ -616,6 +660,8 @@  variants:
                         md5sum_1m = 0dbeb8f58d213752d8c029e8601abfbb
                         unattended_install:
                             unattended_file = unattended/RHEL-5-series.ks
+                            tftp = images/rhel54-32/tftpboot
+                            floppy = images/rhel54-32/floppy.img
 
                     - 5.4.x86_64:
                         no setup
@@ -625,6 +671,8 @@  variants:
                         md5sum_1m = 3e74112003e88a966754849dbb8f5c3f
                         unattended_install:
                             unattended_file = unattended/RHEL-5-series.ks
+                            tftp = images/rhel54-64/tftpboot
+                            floppy = images/rhel54-64/floppy.img
 
     # Windows section
     - @Windows:
@@ -728,6 +776,7 @@  variants:
                             md5sum = 743450644b1d9fe97b3cf379e22dceb0
                             md5sum_1m = b473bf75af2d1269fec8958cf0202bfd
                             unattended_file = unattended/winxp32.sif
+                            floppy = images/winXP-32/floppy.img
 
                     - 64:
                         image_name += -64
@@ -744,6 +793,7 @@  variants:
                             md5sum = 8d3f007ec9c2060cec8a50ee7d7dc512
                             md5sum_1m = e812363ff427effc512b7801ee70e513
                             unattended_file = unattended/winxp64.sif
+                            floppy = images/winXP-64/floppy.img
 
             - Win2003:
                 image_name = win2003
@@ -767,6 +817,7 @@  variants:
                             md5sum = 03e921e9b4214773c21a39f5c3f42ef7
                             md5sum_1m = 37c2fdec15ac4ec16aa10fdfdb338aa3
                             unattended_file = unattended/win2003-32.sif
+                            floppy = images/win2003-32/floppy.img
 
                     - 64:
                         image_name += -64
@@ -783,6 +834,7 @@  variants:
                             md5sum = 5703f87c9fd77d28c05ffadd3354dbbd
                             md5sum_1m = 439393c384116aa09e08a0ad047dcea8
                             unattended_file = unattended/win2003-64.sif
+                            floppy = images/win2003-64/floppy.img
 
             - WinVista:
                 image_name = winvista
@@ -803,6 +855,7 @@  variants:
                             md5sum = 1008f323d5170c8e614e52ccb85c0491
                             md5sum_1m = c724e9695da483bc0fd59e426eaefc72
                             unattended_file = unattended/winvista-32-autounattend.xml
+                            floppy = images/winvista-sp1-32/floppy.img
 
                     - 64sp1:
                         image_name += sp1-64
@@ -818,6 +871,7 @@  variants:
                             md5sum = 11e2010d857fffc47813295e6be6d58d
                             md5sum_1m = 0947bcd5390546139e25f25217d6f165
                             unattended_file = unattended/winvista-64-autounattend.xml
+                            floppy = images/winvista-sp1-64/floppy.img
 
                     - 32sp2:
                         image_name += sp2-32
@@ -828,6 +882,7 @@  variants:
                             sha1sum = 25ad9a776503e6a583bec07879dbcc5dfd20cd6e
                             sha1sum_1m = a2afa4cffdc1c362dbf9e62942337f4f875a22cf
                             unattended_file = unattended/winvista-32-autounattend.xml
+                            floppy = images/winvista-sp2-32/floppy.img
 
                     - 64sp2:
                         image_name += sp2-64
@@ -838,6 +893,7 @@  variants:
                             sha1sum = aaee3c04533899f9f8c4ae0c4250ef5fafbe29a3
                             sha1sum_1m = 1fd21bd3ce2a4de8856c7b8fe6fdf80260f6d1c7
                             unattended_file = unattended/winvista-64-autounattend.xml
+                            floppy = images/winvista-sp2-64/floppy.img
 
             - Win2008:
                 image_name = win2008
@@ -862,6 +918,7 @@  variants:
                             md5sum=0bfca49f0164de0a8eba236ced47007d
                             md5sum_1m=07d7f5006393f74dc76e6e2e943e2440
                             unattended_file = unattended/win2008-32-autounattend.xml
+                            floppy = images/win2008-sp1-32/floppy.img
 
                     - 64sp1:
                         image_name += sp1-64
@@ -880,6 +937,7 @@  variants:
                             md5sum=27c58cdb3d620f28c36333a5552f271c
                             md5sum_1m=efdcc11d485a1ef9afa739cb8e0ca766
                             unattended_file = unattended/win2008-64-autounattend.xml
+                            floppy = images/win2008-sp1-64/floppy.img
 
                     - 32sp2:
                         image_name += sp2-32
@@ -890,6 +948,7 @@  variants:
                             sha1sum = 49d0d6917c1256fe81048d414fa473bbc76a8724
                             sha1sum_1m = 9662ff7ed715faa00407e4befc484ea52a92a9fb
                             unattended_file = unattended/win2008-32-autounattend.xml
+                            floppy = images/win2008-sp2-32/floppy.img
 
                     - 64sp2:
                         image_name += sp2-64
@@ -900,6 +959,7 @@  variants:
                             sha1sum = 34c7d726c57b0f8b19ba3b40d1b4044c15fc2029
                             sha1sum_1m = 8fe08b03e3531906855a60a78020ac9577dff5ba
                             unattended_file = unattended/win2008-64-autounattend.xml
+                            floppy = images/win2008-sp2-64/floppy.img
 
                     - r2:
                         image_name += -r2
@@ -910,6 +970,7 @@  variants:
                             sha1sum = ad855ea913aaec3f1d0e1833c1aef7a0de326b0a
                             sha1sum_1m = 9194a3aabae25b36e5f73cad001314b2c8d07d14
                             unattended_file = unattended/win2008-r2-autounattend.xml
+                            floppy = images/win2008-r2-64/floppy.img
 
             - Win7:
                 image_name = win7
@@ -927,6 +988,7 @@  variants:
                             sha1sum = 5395dc4b38f7bdb1e005ff414deedfdb16dbf610
                             sha1sum_1m = 9f9c3780aebeb28a9bf22188eed6bc15475dc9c5
                             unattended_file = unattended/win7-32-autounattend.xml
+                            floppy = images/win7-32/floppy.img
 
                     - 64:
                         image_name += -64
@@ -945,6 +1007,7 @@  variants:
                             sha1sum = 326327cc2ff9f05379f5058c41be6bc5e004baa7
                             sha1sum_1m = 4a3903bd5157de54f0702e5263e0a683c5775515
                             unattended_file = unattended/win7-64-autounattend.xml
+                            floppy = images/win7-64/floppy.img
 
 
     # Unix/BSD section
diff --git a/client/tests/kvm/unattended/Fedora-10.ks b/client/tests/kvm/unattended/Fedora-10.ks
index 41bb391..61e59d7 100644
--- a/client/tests/kvm/unattended/Fedora-10.ks
+++ b/client/tests/kvm/unattended/Fedora-10.ks
@@ -28,10 +28,10 @@  os.system('dhclient')
 os.system('chkconfig sshd on')
 os.system('iptables -F')
 os.system('echo 0 > /selinux/enforce')
-port = 12323
-buf = 1024
-addr = ('10.0.2.2', port)
-client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-client.connect(addr)
-client.sendto('done', addr)
+server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+server.bind(('', 12323))
+server.listen(1)
+(client, addr) = server.accept()
+client.send("done")
 client.close()
+
diff --git a/client/tests/kvm/unattended/Fedora-11.ks b/client/tests/kvm/unattended/Fedora-11.ks
index 65e42c3..0be7d06 100644
--- a/client/tests/kvm/unattended/Fedora-11.ks
+++ b/client/tests/kvm/unattended/Fedora-11.ks
@@ -28,11 +28,10 @@  os.system('dhclient')
 os.system('chkconfig sshd on')
 os.system('iptables -F')
 os.system('echo 0 > /selinux/enforce')
-port = 12323
-buf = 1024
-addr = ('10.0.2.2', port)
-client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-client.connect(addr)
-client.sendto('done', addr)
+server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+server.bind(('', 12323))
+server.listen(1)
+(client, addr) = server.accept()
+client.send("done")
 client.close()
 %end
diff --git a/client/tests/kvm/unattended/Fedora-12.ks b/client/tests/kvm/unattended/Fedora-12.ks
index 65e42c3..0be7d06 100644
--- a/client/tests/kvm/unattended/Fedora-12.ks
+++ b/client/tests/kvm/unattended/Fedora-12.ks
@@ -28,11 +28,10 @@  os.system('dhclient')
 os.system('chkconfig sshd on')
 os.system('iptables -F')
 os.system('echo 0 > /selinux/enforce')
-port = 12323
-buf = 1024
-addr = ('10.0.2.2', port)
-client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-client.connect(addr)
-client.sendto('done', addr)
+server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+server.bind(('', 12323))
+server.listen(1)
+(client, addr) = server.accept()
+client.send("done")
 client.close()
 %end
diff --git a/client/tests/kvm/unattended/Fedora-8.ks b/client/tests/kvm/unattended/Fedora-8.ks
index 41bb391..f4a872d 100644
--- a/client/tests/kvm/unattended/Fedora-8.ks
+++ b/client/tests/kvm/unattended/Fedora-8.ks
@@ -28,10 +28,9 @@  os.system('dhclient')
 os.system('chkconfig sshd on')
 os.system('iptables -F')
 os.system('echo 0 > /selinux/enforce')
-port = 12323
-buf = 1024
-addr = ('10.0.2.2', port)
-client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-client.connect(addr)
-client.sendto('done', addr)
+server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+server.bind(('', 12323))
+server.listen(1)
+(client, addr) = server.accept()
+client.send("done")
 client.close()
diff --git a/client/tests/kvm/unattended/Fedora-9.ks b/client/tests/kvm/unattended/Fedora-9.ks
index 41bb391..f4a872d 100644
--- a/client/tests/kvm/unattended/Fedora-9.ks
+++ b/client/tests/kvm/unattended/Fedora-9.ks
@@ -28,10 +28,9 @@  os.system('dhclient')
 os.system('chkconfig sshd on')
 os.system('iptables -F')
 os.system('echo 0 > /selinux/enforce')
-port = 12323
-buf = 1024
-addr = ('10.0.2.2', port)
-client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-client.connect(addr)
-client.sendto('done', addr)
+server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+server.bind(('', 12323))
+server.listen(1)
+(client, addr) = server.accept()
+client.send("done")
 client.close()
diff --git a/client/tests/kvm/unattended/RHEL-3-series.ks b/client/tests/kvm/unattended/RHEL-3-series.ks
index 2fcc96e..ad748cb 100644
--- a/client/tests/kvm/unattended/RHEL-3-series.ks
+++ b/client/tests/kvm/unattended/RHEL-3-series.ks
@@ -27,10 +27,10 @@  import socket, os
 os.system('dhclient')
 os.system('chkconfig sshd on')
 os.system('iptables -F')
-port = 12323
-buf = 1024
-addr = ('10.0.2.2', port)
-client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-client.connect(addr)
-client.sendto('done', addr)
+os.system('echo 0 > /selinux/enforce')
+server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+server.bind(('', 12323))
+server.listen(1)
+(client, addr) = server.accept()
+client.send("done")
 client.close()
diff --git a/client/tests/kvm/unattended/RHEL-4-series.ks b/client/tests/kvm/unattended/RHEL-4-series.ks
index 233c98f..ce4a430 100644
--- a/client/tests/kvm/unattended/RHEL-4-series.ks
+++ b/client/tests/kvm/unattended/RHEL-4-series.ks
@@ -28,10 +28,9 @@  os.system('dhclient')
 os.system('chkconfig sshd on')
 os.system('iptables -F')
 os.system('echo 0 > /selinux/enforce')
-port = 12323
-buf = 1024
-addr = ('10.0.2.2', port)
-client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-client.connect(addr)
-client.sendto('done', addr)
+server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+server.bind(('', 12323))
+server.listen(1)
+(client, addr) = server.accept()
+client.send("done")
 client.close()
diff --git a/client/tests/kvm/unattended/RHEL-5-series.ks b/client/tests/kvm/unattended/RHEL-5-series.ks
index 41bb391..f4a872d 100644
--- a/client/tests/kvm/unattended/RHEL-5-series.ks
+++ b/client/tests/kvm/unattended/RHEL-5-series.ks
@@ -28,10 +28,9 @@  os.system('dhclient')
 os.system('chkconfig sshd on')
 os.system('iptables -F')
 os.system('echo 0 > /selinux/enforce')
-port = 12323
-buf = 1024
-addr = ('10.0.2.2', port)
-client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-client.connect(addr)
-client.sendto('done', addr)
+server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+server.bind(('', 12323))
+server.listen(1)
+(client, addr) = server.accept()
+client.send("done")
 client.close()
diff --git a/client/tests/kvm/unattended/win2003-32.sif b/client/tests/kvm/unattended/win2003-32.sif
index 85d4694..f58b0b0 100644
--- a/client/tests/kvm/unattended/win2003-32.sif
+++ b/client/tests/kvm/unattended/win2003-32.sif
@@ -61,4 +61,4 @@ 
     Command2="cmd /c net start telnet"
     Command3="cmd /c E:\setuprss.bat"
     Command4="cmd /c netsh interface ip set address local dhcp"
-    Command5="cmd /c ping 10.0.2.2 -n 20 && A:\finish.exe 10.0.2.2"
+    Command5="cmd /c ping 10.0.2.2 -n 20 && A:\finish.exe"
diff --git a/client/tests/kvm/unattended/win2003-64.sif b/client/tests/kvm/unattended/win2003-64.sif
index 85d4694..f58b0b0 100644
--- a/client/tests/kvm/unattended/win2003-64.sif
+++ b/client/tests/kvm/unattended/win2003-64.sif
@@ -61,4 +61,4 @@ 
     Command2="cmd /c net start telnet"
     Command3="cmd /c E:\setuprss.bat"
     Command4="cmd /c netsh interface ip set address local dhcp"
-    Command5="cmd /c ping 10.0.2.2 -n 20 && A:\finish.exe 10.0.2.2"
+    Command5="cmd /c ping 10.0.2.2 -n 20 && A:\finish.exe"
diff --git a/client/tests/kvm/unattended/win2008-32-autounattend.xml b/client/tests/kvm/unattended/win2008-32-autounattend.xml
index e5f244b..c6fafac 100644
--- a/client/tests/kvm/unattended/win2008-32-autounattend.xml
+++ b/client/tests/kvm/unattended/win2008-32-autounattend.xml
@@ -140,7 +140,7 @@ 
 				</SynchronousCommand>
 				<SynchronousCommand wcm:action="add">
 					<Order>7</Order>
-					<CommandLine>%WINDIR%\System32\cmd /c ping 10.0.2.2 -n 20 &#38;&#38; A:\finish.exe 10.0.2.2</CommandLine>
+					<CommandLine>%WINDIR%\System32\cmd /c ping 10.0.2.2 -n 20 &#38;&#38; A:\finish.exe</CommandLine>
 				</SynchronousCommand>
 			</FirstLogonCommands>
 			<OOBE>
diff --git a/client/tests/kvm/unattended/win2008-64-autounattend.xml b/client/tests/kvm/unattended/win2008-64-autounattend.xml
index 68f6fcf..2520a7a 100644
--- a/client/tests/kvm/unattended/win2008-64-autounattend.xml
+++ b/client/tests/kvm/unattended/win2008-64-autounattend.xml
@@ -149,7 +149,7 @@ 
 				</SynchronousCommand>
 				<SynchronousCommand wcm:action="add">
 					<Order>7</Order>
-					<CommandLine>%WINDIR%\System32\cmd /c ping 10.0.2.2 -n 20 &#38;&#38; A:\finish.exe 10.0.2.2</CommandLine>
+					<CommandLine>%WINDIR%\System32\cmd /c ping 10.0.2.2 -n 20 &#38;&#38; A:\finish.exe</CommandLine>
 				</SynchronousCommand>
 			</FirstLogonCommands>
 			<OOBE>
diff --git a/client/tests/kvm/unattended/win2008-r2-autounattend.xml b/client/tests/kvm/unattended/win2008-r2-autounattend.xml
index 68f6fcf..2520a7a 100644
--- a/client/tests/kvm/unattended/win2008-r2-autounattend.xml
+++ b/client/tests/kvm/unattended/win2008-r2-autounattend.xml
@@ -149,7 +149,7 @@ 
 				</SynchronousCommand>
 				<SynchronousCommand wcm:action="add">
 					<Order>7</Order>
-					<CommandLine>%WINDIR%\System32\cmd /c ping 10.0.2.2 -n 20 &#38;&#38; A:\finish.exe 10.0.2.2</CommandLine>
+					<CommandLine>%WINDIR%\System32\cmd /c ping 10.0.2.2 -n 20 &#38;&#38; A:\finish.exe</CommandLine>
 				</SynchronousCommand>
 			</FirstLogonCommands>
 			<OOBE>
diff --git a/client/tests/kvm/unattended/win7-32-autounattend.xml b/client/tests/kvm/unattended/win7-32-autounattend.xml
index e858ce9..c37afb7 100644
--- a/client/tests/kvm/unattended/win7-32-autounattend.xml
+++ b/client/tests/kvm/unattended/win7-32-autounattend.xml
@@ -146,7 +146,7 @@ 
 					<Order>6</Order>
 				</SynchronousCommand>
 				<SynchronousCommand wcm:action="add">
-					<CommandLine>%WINDIR%\System32\cmd /c ping 10.0.2.2 -n 20 &#38;&#38; A:\finish.exe 10.0.2.2</CommandLine>
+					<CommandLine>%WINDIR%\System32\cmd /c ping 10.0.2.2 -n 20 &#38;&#38; A:\finish.exe</CommandLine>
 					<Order>7</Order>
 				</SynchronousCommand>
 			</FirstLogonCommands>
diff --git a/client/tests/kvm/unattended/win7-64-autounattend.xml b/client/tests/kvm/unattended/win7-64-autounattend.xml
index 1bff3c9..ad047d0 100644
--- a/client/tests/kvm/unattended/win7-64-autounattend.xml
+++ b/client/tests/kvm/unattended/win7-64-autounattend.xml
@@ -146,7 +146,7 @@ 
 					<Order>6</Order>
 				</SynchronousCommand>
 				<SynchronousCommand wcm:action="add">
-					<CommandLine>%WINDIR%\System32\cmd /c ping 10.0.2.2 -n 20 &#38;&#38; A:\finish.exe 10.0.2.2</CommandLine>
+					<CommandLine>%WINDIR%\System32\cmd /c ping 10.0.2.2 -n 20 &#38;&#38; A:\finish.exe</CommandLine>
 					<Order>7</Order>
 				</SynchronousCommand>
 			</FirstLogonCommands>
diff --git a/client/tests/kvm/unattended/winvista-32-autounattend.xml b/client/tests/kvm/unattended/winvista-32-autounattend.xml
index 443aec6..297c6e5 100644
--- a/client/tests/kvm/unattended/winvista-32-autounattend.xml
+++ b/client/tests/kvm/unattended/winvista-32-autounattend.xml
@@ -147,7 +147,7 @@ 
 				</SynchronousCommand>
 				<SynchronousCommand wcm:action="add">
 					<Order>7</Order>
-					<CommandLine>%WINDIR%\System32\cmd /c ping 10.0.2.2 -n 20 &#38;&#38; A:\finish.exe 10.0.2.2</CommandLine>
+					<CommandLine>%WINDIR%\System32\cmd /c ping 10.0.2.2 -n 20 &#38;&#38; A:\finish.exe</CommandLine>
 				</SynchronousCommand>
 			</FirstLogonCommands>
 		</component>
diff --git a/client/tests/kvm/unattended/winvista-64-autounattend.xml b/client/tests/kvm/unattended/winvista-64-autounattend.xml
index ec35cbb..71eae87 100644
--- a/client/tests/kvm/unattended/winvista-64-autounattend.xml
+++ b/client/tests/kvm/unattended/winvista-64-autounattend.xml
@@ -148,7 +148,7 @@ 
 				</SynchronousCommand>
 				<SynchronousCommand wcm:action="add">
 					<Order>7</Order>
-					<CommandLine>%WINDIR%\System32\cmd /c ping 10.0.2.2 -n 20 &#38;&#38; A:\finish.exe 10.0.2.2</CommandLine>
+					<CommandLine>%WINDIR%\System32\cmd /c ping 10.0.2.2 -n 20 &#38;&#38; A:\finish.exe</CommandLine>
 				</SynchronousCommand>
 			</FirstLogonCommands>
 		</component>
diff --git a/client/tests/kvm/unattended/winxp32.sif b/client/tests/kvm/unattended/winxp32.sif
index 4711a3d..7562846 100644
--- a/client/tests/kvm/unattended/winxp32.sif
+++ b/client/tests/kvm/unattended/winxp32.sif
@@ -70,4 +70,4 @@ 
 [GuiRunOnce]
    Command0="cmd /c E:\setuprss.bat"
    Command1="cmd /c netsh interface ip set address local dhcp"
-   Command2="cmd /c ping 10.0.2.2 -n 20 && A:\finish.exe 10.0.2.2"
+   Command2="cmd /c ping 10.0.2.2 -n 20 && A:\finish.exe"
diff --git a/client/tests/kvm/unattended/winxp64.sif b/client/tests/kvm/unattended/winxp64.sif
index 4711a3d..7562846 100644
--- a/client/tests/kvm/unattended/winxp64.sif
+++ b/client/tests/kvm/unattended/winxp64.sif
@@ -70,4 +70,4 @@ 
 [GuiRunOnce]
    Command0="cmd /c E:\setuprss.bat"
    Command1="cmd /c netsh interface ip set address local dhcp"
-   Command2="cmd /c ping 10.0.2.2 -n 20 && A:\finish.exe 10.0.2.2"
+   Command2="cmd /c ping 10.0.2.2 -n 20 && A:\finish.exe"