diff mbox

[2/3] KVM test: Do not use the hard-coded address during unattended installation

Message ID 20100528082509.31543.671.stgit@dhcp-91-25.nay.redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jason Wang May 28, 2010, 8:25 a.m. UTC
None
diff mbox

Patch

diff --git a/client/tests/kvm/tests/unattended_install.py b/client/tests/kvm/tests/unattended_install.py
index e2cec8e..8928575 100644
--- a/client/tests/kvm/tests/unattended_install.py
+++ b/client/tests/kvm/tests/unattended_install.py
@@ -17,7 +17,6 @@  def run_unattended_install(test, params, env):
     vm = kvm_test_utils.get_living_vm(env, params.get("main_vm"))
 
     port = vm.get_port(int(params.get("guest_port_unattended_install")))
-    addr = ('localhost', port)
     if params.get("post_install_delay"):
         post_install_delay = int(params.get("post_install_delay"))
     else:
@@ -31,17 +30,19 @@  def run_unattended_install(test, params, env):
     time_elapsed = 0
     while time_elapsed < install_timeout:
         client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-        try:
-            client.connect(addr)
-            msg = client.recv(1024)
-            if msg == 'done':
-                if post_install_delay:
-                    logging.debug("Post install delay specified, "
-                                  "waiting %ss...", post_install_delay)
-                    time.sleep(post_install_delay)
-                break
-        except socket.error:
-            pass
+        addr = vm.get_address()
+        if addr is not None:
+            try:
+                client.connect((addr, port))
+                msg = client.recv(1024)
+                if msg == 'done':
+                    if post_install_delay:
+                        logging.debug("Post install delay specified, "
+                                      "waiting %ss...", post_install_delay)
+                        time.sleep(post_install_delay)
+                    break
+            except socket.error:
+                pass
         time.sleep(1)
         client.close()
         end_time = time.time()