autotest: Make sure devserver stages artifacts before CrOS auto-update
When devserver for staging becomes not healthy, autoserv will resolve a new
devserver, which is not staging the proper builds, to execute CrOS auto-update.
This will leads to provision failure.
This CL let the new resolved devserver stage the builds, and then do CrOS
auto-update.
BUG=chromium:651149
TEST=Copy codes to hot, run provision on hot to test the code flow.
Change-Id: I88608f4a3c23b2b64c5bae4439ccaecf0b0fb9af
Reviewed-on: https://chromium-review.googlesource.com/391030
Commit-Ready: Xixuan Wu <xixuan@chromium.org>
Tested-by: Xixuan Wu <xixuan@chromium.org>
Reviewed-by: Dan Shi <dshi@google.com>
diff --git a/server/hosts/cros_host.py b/server/hosts/cros_host.py
index 28f4fd2..07d5cd9 100644
--- a/server/hosts/cros_host.py
+++ b/server/hosts/cros_host.py
@@ -713,6 +713,13 @@
if update_url.startswith('http://'):
build = autoupdater.url_to_image_name(update_url)
devserver = dev_server.ImageServer.resolve(build, self.hostname)
+ # Make sure devserver for Auto-Update has staged the build.
+ server_name = dev_server.ImageServer.get_server_name(devserver.url())
+ if server_name not in update_url:
+ logging.debug('Devserver that stages artifacts is not healthy, '
+ 'switch to use devserver %s, will re-stage.',
+ server_name)
+ devserver.trigger_download(build, synchronous=False)
else:
build = update_url
devserver = dev_server.ImageServer.resolve(build, self.hostname)