devserver: support for serving remotely hosted payloads
This feature is aimed to allow one instance of a devserver to respond to
an update check with a link to a payload that's hosted (statically
staged) on another devserver. Specifically, we plan on using it in the
test lab to spawn test-private devserver instances that will direct DUTs
to obtain their payloads from a central devserver. To use this feature,
the test-private instance should be invoked with the following switches:
--archive_dir=static/ (avoids payload generation, value insignificant)
--urlbase=http://<central-devserver-hostname>:<port>
--payload=static/<path>/<to>/<payload>/<file>
--remote_payload (triggers proper handling of the remote payload)
Note that the --payload value is optional, and is only used if the
update check issued by the client does not contain a payload URL, for
example: .../update/static/<path>/<to>/<payload>/<file>
* Adds a new option --remote_payload for triggering special handling of
remotely hosted payload files. This is hard to infer based on existing
options (such as --urlbase) and disambiguates the behavior.
* Added functionality for retrieving necessary attributes of the remote
payload file, such as size and hashes, which need to be send back to
the DUT in the update response.
* The payload file name is assumed to be a devserver constant
(update.gz).
* The remote payload URL is assumed to have a /static prefix to it. This
invariant must be preserved by both the client (request) and the
backend devserver (provisioning).
* Added unit test to cover remote payload logic.
BUG=chromium-os:33762
TEST=Devserver responds with remote payload data; passes unit tests.
Change-Id: Ief34bbd18d9046460f2b2a7a6c88b465d65426e8
Reviewed-on: https://gerrit.chromium.org/gerrit/34499
Reviewed-by: Chris Sosa <[email protected]>
Reviewed-by: Scott Zawalski <[email protected]>
Commit-Ready: Gilad Arnold <[email protected]>
Tested-by: Gilad Arnold <[email protected]>
diff --git a/devserver.py b/devserver.py
index 5e45236..b602145 100755
--- a/devserver.py
+++ b/devserver.py
@@ -632,6 +632,8 @@
help='Have the devserver use production values.')
parser.add_option('--proxy_port', default=None,
help='Port to have the client connect to (testing support)')
+ parser.add_option('--remote_payload', action='store_true', default=False,
+ help='Payload is being served from a remote machine.')
parser.add_option('--src_image', default='',
help='Image on remote machine for generating delta update.')
parser.add_option('-t', action='store_true', dest='test_image')
@@ -698,8 +700,7 @@
test_image=options.test_image,
factory_config_path=options.factory_config,
forced_image=options.image,
- forced_payload=options.payload,
- port=options.port,
+ payload_path=options.payload,
proxy_port=options.proxy_port,
src_image=options.src_image,
vm=options.vm,
@@ -707,6 +708,7 @@
copy_to_static_root=not options.exit,
private_key=options.private_key,
critical_update=options.critical_update,
+ remote_payload=options.remote_payload,
)
# Sanity-check for use of validate_factory_config.