[autotest] Getting mixed HQEs and special tasks fail on shard AFE
BUG=chromium:486926
TEST=Prepare shard testing cluster. Run a dummy suite on a DUT
that is sharded, and check if I can get mixed HQEs and special tasks
on the shard AFE.
Change-Id: I66449e07d6f5ae4c5e39ee87d4608b8eae9777f3
Reviewed-on: https://chromium-review.googlesource.com/270342
Reviewed-by: Dan Shi <dshi@chromium.org>
Tested-by: Mungyung Ryu <mkryu@google.com>
Commit-Queue: Mungyung Ryu <mkryu@google.com>
diff --git a/frontend/afe/models.py b/frontend/afe/models.py
index e2f0b1f..418e985 100644
--- a/frontend/afe/models.py
+++ b/frontend/afe/models.py
@@ -174,8 +174,14 @@
# afe links/redirection from the frontend (this happens through the
# host), but for rpcs that are performed *on* the shard, they need to
# use the address of the gateway.
- hostname = self.hostname.split(':')[0]
- if site_utils.is_localhost(hostname):
+ # In the virtual machine testing environment (i.e., puppylab), each
+ # shard VM has a hostname like localhost:<port>. In the real cluster
+ # environment, a shard node does not have 'localhost' for its hostname.
+ # The following hostname substitution is needed only for the VM
+ # in puppylab.
+ # The 'hostname' should not be replaced in the case of real cluster.
+ if site_utils.is_puppylab_vm(self.hostname):
+ hostname = self.hostname.split(':')[0]
return self.hostname.replace(
hostname, site_utils.DEFAULT_VM_GATEWAY)
return self.hostname