autotest: Use label names from AFE client instead of IDs.

master-shard databases do not necessarily have the same id for labels.
So use the label name instead of the id when updating them.

BUG=chromium:782797
TEST=None

Change-Id: I2a8c1ec2d671151caff31121ca6f9585372dfed3
Reviewed-on: https://chromium-review.googlesource.com/759103
Commit-Ready: Prathmesh Prabhu <pprabhu@chromium.org>
Tested-by: Prathmesh Prabhu <pprabhu@chromium.org>
Reviewed-by: Prathmesh Prabhu <pprabhu@chromium.org>
Reviewed-by: Allen Li <ayatane@chromium.org>
diff --git a/server/frontend.py b/server/frontend.py
index a643ff4..3c143ab 100644
--- a/server/frontend.py
+++ b/server/frontend.py
@@ -807,11 +807,15 @@
 
 
     def add_hosts(self, hosts):
-        return self.afe.run('label_add_hosts', id=self.id, hosts=hosts)
+        # We must use the label's name instead of the id because label ids are
+        # not consistent across master-shard.
+        return self.afe.run('label_add_hosts', id=self.name, hosts=hosts)
 
 
     def remove_hosts(self, hosts):
-        return self.afe.run('label_remove_hosts', id=self.id, hosts=hosts)
+        # We must use the label's name instead of the id because label ids are
+        # not consistent across master-shard.
+        return self.afe.run('label_remove_hosts', id=self.name, hosts=hosts)
 
 
 class Acl(RpcObject):