diff options
| author | Jenkins <jenkins@review.openstack.org> | 2014-04-04 07:16:50 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2014-04-04 07:16:50 +0000 |
| commit | fc2c916ce47afbe01bc3ec4222525bf17a8840ae (patch) | |
| tree | fc0163f3cd5f34ee44266b444bdf0ab90e86d3c7 /cinderclient/v1/shell.py | |
| parent | 6dc3185ca11be3d729433456459e7fc906e74e83 (diff) | |
| parent | 8a59f2ca572ff9aebe4f62e2d750f6a6c551598a (diff) | |
| download | python-cinderclient-fc2c916ce47afbe01bc3ec4222525bf17a8840ae.tar.gz | |
Merge "CLI for disable service reason"
Diffstat (limited to 'cinderclient/v1/shell.py')
| -rw-r--r-- | cinderclient/v1/shell.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/cinderclient/v1/shell.py b/cinderclient/v1/shell.py index 6a11c2a..b13e369 100644 --- a/cinderclient/v1/shell.py +++ b/cinderclient/v1/shell.py @@ -995,6 +995,10 @@ def do_service_list(cs, args): """List all the services. Filter by host & service binary.""" result = cs.services.list(host=args.host, binary=args.binary) columns = ["Binary", "Host", "Zone", "Status", "State", "Updated_at"] + # NOTE(jay-lau-513): we check if the response has disabled_reason + # so as not to add the column when the extended ext is not enabled. + if result and hasattr(result[0], 'disabled_reason'): + columns.append("Disabled Reason") utils.print_list(result, columns) @@ -1010,11 +1014,18 @@ def do_service_enable(cs, args): @utils.arg('host', metavar='<hostname>', help='Name of host.') @utils.arg('binary', metavar='<binary>', help='Service binary.') +@utils.arg('--reason', metavar='<reason>', + help='Reason for disabling service.') @utils.service_type('volume') def do_service_disable(cs, args): """Disable the service.""" - result = cs.services.disable(args.host, args.binary) columns = ["Host", "Binary", "Status"] + if args.reason: + columns.append('Disabled Reason') + result = cs.services.disable_log_reason(args.host, args.binary, + args.reason) + else: + result = cs.services.disable(args.host, args.binary) utils.print_list([result], columns) |
