diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2014-04-30 13:32:00 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-04-30 21:52:32 +0100 |
commit | 74f2d8b013b3f548b546d46664256e7f4845791e (patch) | |
tree | 7024c0efc43a38dabb5b64f88cf8f6cd46fd53bc /meta/lib | |
parent | 6cd18d7f91b1c6b378f4d6e048382ec1fc748a63 (diff) | |
download | poky-74f2d8b013b3f548b546d46664256e7f4845791e.tar.gz |
oeqa/controllers/masterimage: more robust master image startup
Instead of powering up the target when the object is constructed, wait
until deploy is called. Then there are basically two different
scenarios:
a) The device is booted into the master image already, in which case
we can just use it
b) The device is booted into another image or can't be contacted, in
which case we need to power cycle it. Here we also now wait until it
has booted up instead of trying to contact it immediately.
(From OE-Core rev: c2257fa50071e4704a8152b5f1d16f899b4bed98)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r-- | meta/lib/oeqa/controllers/masterimage.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/meta/lib/oeqa/controllers/masterimage.py b/meta/lib/oeqa/controllers/masterimage.py index c6fc7d60e0..d151e24bd7 100644 --- a/meta/lib/oeqa/controllers/masterimage.py +++ b/meta/lib/oeqa/controllers/masterimage.py | |||
@@ -87,7 +87,6 @@ class MasterImageHardwareTarget(oeqa.targetcontrol.BaseTarget): | |||
87 | if self.powercontrol_cmd: | 87 | if self.powercontrol_cmd: |
88 | if self.powercontrol_args: | 88 | if self.powercontrol_args: |
89 | self.powercontrol_cmd = "%s %s" % (self.powercontrol_cmd, self.powercontrol_args) | 89 | self.powercontrol_cmd = "%s %s" % (self.powercontrol_cmd, self.powercontrol_args) |
90 | self.power_ctl("on") | ||
91 | if self.serialcontrol_cmd: | 90 | if self.serialcontrol_cmd: |
92 | if self.serialcontrol_args: | 91 | if self.serialcontrol_args: |
93 | self.serialcontrol_cmd = "%s %s" % (self.serialcontrol_cmd, self.serialcontrol_args) | 92 | self.serialcontrol_cmd = "%s %s" % (self.serialcontrol_cmd, self.serialcontrol_args) |
@@ -108,13 +107,25 @@ class MasterImageHardwareTarget(oeqa.targetcontrol.BaseTarget): | |||
108 | if status != 0: | 107 | if status != 0: |
109 | bb.error("Failed rebooting target and no power control command defined. You need to manually reset the device.\n%s" % output) | 108 | bb.error("Failed rebooting target and no power control command defined. You need to manually reset the device.\n%s" % output) |
110 | 109 | ||
110 | def _wait_until_booted(self): | ||
111 | ''' Waits until the target device has booted (if we have just power cycled it) ''' | ||
112 | # Subclasses with better methods of determining boot can override this | ||
113 | time.sleep(120) | ||
114 | |||
111 | def deploy(self): | 115 | def deploy(self): |
112 | bb.plain("%s - deploying image on target" % self.pn) | ||
113 | # base class just sets the ssh log file for us | 116 | # base class just sets the ssh log file for us |
114 | super(MasterImageHardwareTarget, self).deploy() | 117 | super(MasterImageHardwareTarget, self).deploy() |
115 | self.master = sshcontrol.SSHControl(ip=self.ip, logfile=self.sshlog, timeout=600, port=self.port) | 118 | self.master = sshcontrol.SSHControl(ip=self.ip, logfile=self.sshlog, timeout=600, port=self.port) |
116 | status, output = self.master.run("cat /etc/masterimage") | 119 | status, output = self.master.run("cat /etc/masterimage") |
117 | if status != 0: | 120 | if status != 0: |
121 | # We're not booted into the master image, so try rebooting | ||
122 | bb.plain("%s - booting into the master image" % self.pn) | ||
123 | self.power_ctl("cycle") | ||
124 | self._wait_until_booted() | ||
125 | |||
126 | bb.plain("%s - deploying image on target" % self.pn) | ||
127 | status, output = self.master.run("cat /etc/masterimage") | ||
128 | if status != 0: | ||
118 | bb.fatal("No ssh connectivity or target isn't running a master image.\n%s" % output) | 129 | bb.fatal("No ssh connectivity or target isn't running a master image.\n%s" % output) |
119 | if self.user_cmds: | 130 | if self.user_cmds: |
120 | self.deploy_cmds = self.user_cmds.split("\n") | 131 | self.deploy_cmds = self.user_cmds.split("\n") |