[autotest] Send labels to shards preserving their ids.
We were allowing deviations between a shard and the master
by not specifying the label id for forwarded label create
rpcs. This cl breaks down the forwarding into 2 phases,
the first to create the label and the second to add the label
to the host, and sends the label id as part of the packet for
label creation.
TEST=atest label add -m host_not_on_shard new_label1
atest label add -m host_on_shard new_label2
checked that new_label2 have the same id on the master and shard.
BUG=chromium:448367
DEPLOY=apache
Change-Id: I29c99ca3fa25a0a3cb2cd91b759db009ee346799
Reviewed-on: https://chromium-review.googlesource.com/248835
Tested-by: Mungyung Ryu <mkryu@google.com>
Reviewed-by: Dan Shi <dshi@chromium.org>
Commit-Queue: Mungyung Ryu <mkryu@google.com>
diff --git a/cli/atest_migrate_host b/cli/atest_migrate_host
index bbe7150..c48e3f8 100755
--- a/cli/atest_migrate_host
+++ b/cli/atest_migrate_host
@@ -30,8 +30,8 @@
if not new.get_labels(name=label.name):
print label
new_label = new.create_label(name=label.name,
- platform=label.platform,
- only_if_needed=label.only_if_needed)
+ platform=label.platform,
+ only_if_needed=label.only_if_needed)
# Add any missing labels to the machine
if not [l for l in new_host.get_labels() if l.name == label.name]:
new_host.add_labels([label.name])