[autotest] Forcefully modify host locking status via cli
When host locking status is inconsistent between masterDB and shardDB for some
unknown rpc reasons, we may need to forcefully lock the host both in
masterDB and shardDB gaurantee the lab reliability.
BUG=chromium:568193
TEST=Test locally. Test in puppetlab to lock an already locked host and
unlock an already unlocked host.
Change-Id: I83f53da0a2e76dedfc8e58deb609073efec5f369
Reviewed-on: https://chromium-review.googlesource.com/321792
Commit-Ready: Shuqian Zhao <shuqianz@chromium.org>
Tested-by: Shuqian Zhao <shuqianz@chromium.org>
Reviewed-by: Shuqian Zhao <shuqianz@chromium.org>
diff --git a/cli/host.py b/cli/host.py
index 4ef26bf..440033e 100644
--- a/cli/host.py
+++ b/cli/host.py
@@ -311,7 +311,7 @@
class host_mod(host):
- """atest host mod --lock|--unlock|--protection
+ """atest host mod --lock|--unlock|--force_modify_locking|--protection
--mlist <file>|<hosts>"""
usage_action = 'mod'
attribute_regex = r'^(?P<attribute>\w+)=(?P<value>.+)?'
@@ -329,6 +329,9 @@
self.parser.add_option('-u', '--unlock',
help='Unlock hosts',
action='store_true')
+ self.parser.add_option('-f', '--force_modify_locking',
+ help='Forcefully lock\unlock a host',
+ action='store_true')
self.parser.add_option('-r', '--lock_reason',
help='Reason for locking hosts',
default='')
@@ -349,6 +352,8 @@
(options, leftover) = super(host_mod, self).parse()
self._parse_lock_options(options)
+ if options.force_modify_locking:
+ self.data['force_modify_locking'] = True
if options.protection:
self.data['protection'] = options.protection