[autotest] Log forwarding for shards
tko/retrieve_logs.cgi reads the value of "[SERVER] shards" in config file
to forward logs relevant to a shard to the shard.
whenever a shard node is added/deleted/updated, we should create a CL that
updates the file
chromeos-admin/puppet/modules/lab/templates/cautotest_shadow_config.ini.erb,
merge it to the tree, and push to prod.
This is not scalable.
This CL makes retrieve_logs.cgi refer to server db to get the list
of shard hostnames.
BUG=chromium:467104
TEST=In local autotest setting, click 'debug log' of a completed job
and checks if shard hostnames are retrieved from server db.
Change-Id: If4dcd0516107577375f2fda9497a1c939ac8775c
Reviewed-on: https://chromium-review.googlesource.com/285315
Reviewed-by: Dan Shi <[email protected]>
Commit-Queue: Mungyung Ryu <[email protected]>
Tested-by: Mungyung Ryu <[email protected]>
diff --git a/site_utils/server_manager_utils.py b/site_utils/server_manager_utils.py
index da93add..9a1d4e3 100644
--- a/site_utils/server_manager_utils.py
+++ b/site_utils/server_manager_utils.py
@@ -283,6 +283,16 @@
return [s.hostname for s in servers]
+def get_shards():
+ """Get a list of shards in status primary.
+
+ @return: A list of shards in status primary.
+ """
+ servers = get_servers(role=server_models.ServerRole.ROLE.SHARD,
+ status=server_models.Server.STATUS.PRIMARY)
+ return [s.hostname for s in servers]
+
+
def confirm_server_has_role(hostname, role):
"""Confirm a given server has the given role, and its status is primary.