[Branch,~linaro-validation/lava-dispatcher/trunk] Rev 142: Fix an issue with a severely long delay before booting the master image

Message ID 20111020145210.20965.75217.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

Paul Larson Oct. 20, 2011, 2:52 p.m.
Merge authors:
  Paul Larson (pwlars)
Related merge proposals:
  https://code.launchpad.net/~pwlars/lava-dispatcher/in_master_shell_timeout/+merge/79893
  proposed by: Paul Larson (pwlars)
  review: Needs Fixing - Michael Hudson-Doyle (mwhudson)
------------------------------------------------------------
revno: 142 [merge]
committer: Paul Larson <paul.larson@canonical.com>
branch nick: lava-dispatcher
timestamp: Thu 2011-10-20 09:49:29 -0500
message:
  Fix an issue with a severely long delay before booting the master image
  to collect results
modified:
  lava_dispatcher/actions/launch_control.py
  lava_dispatcher/client.py


--
lp:lava-dispatcher
https://code.launchpad.net/~linaro-validation/lava-dispatcher/trunk

You are subscribed to branch lp:lava-dispatcher.
To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-dispatcher/trunk/+edit-subscription

Patch

=== modified file 'lava_dispatcher/actions/launch_control.py'
--- lava_dispatcher/actions/launch_control.py	2011-10-18 02:38:34 +0000
+++ lava_dispatcher/actions/launch_control.py	2011-10-20 14:48:09 +0000
@@ -106,7 +106,9 @@ 
         """
         client = self.client
         try:
-            self.in_master_shell()
+            client.in_master_shell()
+        except OperationFailed:
+            client.boot_master_image()
         except:
             logging.exception("in_master_shell failed")
             client.boot_master_image()
@@ -154,11 +156,10 @@ 
                 while time.time() < now + timeout:
                     try:
                         result_path = download(result_tarball, tarball_dir)
-                    except:
+                    except RuntimeError:
                         if time.time() >= now + timeout:
+                            logging.exception("download failed")
                             raise
-                        else:
-                            logging.exception("download failed, retrying")
             except:
                 logging.warning(traceback.format_exc())
                 status = 'fail'

=== modified file 'lava_dispatcher/client.py'
--- lava_dispatcher/client.py	2011-10-20 04:09:15 +0000
+++ lava_dispatcher/client.py	2011-10-20 14:49:29 +0000
@@ -76,11 +76,12 @@ 
     def default_network_interface(self):
         return self.device_option("default_network_interface")
 
-    def in_master_shell(self):
+    def in_master_shell(self, timeout=10):
         """ Check that we are in a shell on the master image
         """
         self.proc.sendline("")
-        id = self.proc.expect([self.master_str, pexpect.TIMEOUT])
+        id = self.proc.expect([self.master_str, pexpect.TIMEOUT],
+            timeout=timeout)
         if id == 1:
             raise OperationFailed
 
@@ -98,11 +99,11 @@ 
         self.soft_reboot()
         try:
             self.proc.expect("Starting kernel")
-            self.in_master_shell()
+            self.in_master_shell(120)
         except:
             logging.exception("in_master_shell failed")
             self.hard_reboot()
-            self.in_master_shell()
+            self.in_master_shell(300)
         self.proc.sendline('export PS1="$PS1 [rc=$(echo \$?)]: "')
         self.proc.expect(self.master_str)
 
@@ -148,7 +149,7 @@ 
         # XXX Workaround for snowball
         if self.device_type == "snowball_sd":
             time.sleep(10)
-            self.in_master_shell()
+            self.in_master_shell(300)
             # Intentionally avoid self.soft_reboot() to prevent looping
             self.proc.sendline("reboot")
             self.enter_uboot()