diff mbox

KVM test: Unattended install logging improvements

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

Commit Message

Lucas Meneghel Rodrigues Jan. 17, 2010, 3:08 p.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 d33d4f1..18561f6 100644
--- a/client/tests/kvm/tests/unattended_install.py
+++ b/client/tests/kvm/tests/unattended_install.py
@@ -15,15 +15,18 @@  def run_unattended_install(test, params, env):
     """
     vm = kvm_test_utils.get_living_vm(env, params.get("main_vm"))
 
-    logging.info("Starting unattended install watch process")
     server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
     server.bind(('', 12323))
     server.listen(1)
 
-    end_time = time.time() + float(params.get("timeout", 3000))
+    install_timeout = params.get("timeout", 3000)
+    logging.info("Starting unattended install watch process. "
+                 "Timeout set to %ss (%s min)", install_timeout,
+                 install_timeout/60)
+    start_time = time.time()
 
     while True:
-        server.settimeout(end_time - time.time())
+        server.settimeout(float(install_timeout))
         try:
             (client, addr) = server.accept()
         except socket.timeout:
@@ -33,7 +36,10 @@  def run_unattended_install(test, params, env):
         msg = client.recv(1024)
         logging.debug("Received '%s' from %s", msg, addr)
         if msg == 'done':
-            logging.info('Guest reported successful installation')
+            end_time = time.time()
+            time_elapsed = int(end_time - start_time)
+            logging.info('Guest reported successful installation after %ss '
+                         '(%s min)', time_elapsed, time_elapsed/60)
             server.close()
             break
         else: