- Expose the lock_time and protection fields in host stat.
- Allow users to set the protection level through the CLI.
Risk(Low): Changes affect host_stat and host_mod. Verified working.
Visibility(Medium): Users will notice new functionality in the CLI
Signed-off-by: Ryan Kubiak <rkubiak@google.com>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@2303 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/cli/host.py b/cli/host.py
index ea57261..626abbd 100755
--- a/cli/host.py
+++ b/cli/host.py
@@ -188,7 +188,8 @@
print '-'*5
self.print_fields(stats,
keys=['hostname', 'platform',
- 'status', 'locked', 'locked_by'])
+ 'status', 'locked', 'locked_by',
+ 'lock_time', 'protection',])
self.print_by_ids(acls, 'ACLs', line_before=True)
labels = self._cleanup_labels(labels)
self.print_by_ids(labels, 'Labels', line_before=True)
@@ -270,13 +271,18 @@
self.parser.add_option('-d', '--dead',
help='Mark this host dead',
action='store_true')
-
self.parser.add_option('-l', '--lock',
help='Lock hosts',
action='store_true')
self.parser.add_option('-u', '--unlock',
help='Unlock hosts',
action='store_true')
+ self.parser.add_option('-p', '--protection', type='choice',
+ help='Set the protection level on a host. Must '
+ 'be one of: "Repair filesystem only", '
+ '"No protection", or "Do not repair"',
+ choices=('No protection', 'Do not repair',
+ 'Repair filesystem only'))
def parse(self):
@@ -296,6 +302,9 @@
self.data['status'] = 'Dead'
self.messages.append('Set status to Dead for host')
+ if options.protection:
+ self.data['protection'] = options.protection
+
if len(self.data) == 0:
self.invalid_syntax('No modification requested')
return (options, leftover)