Add 'Forced down' column in serivce-list

Starting from microversion 2.11,
the 'force_down' parameter is returned in the response of
the "List Compute Services" API (GET /os-services).

But the service-list command does not show the 'forced_down' parameter
in the result table.
So add the 'Forced down' column in the table.

Change-Id: I79e3ba37bdf054604eab40452628dbf30014f6f1
Closes-Bug: #1706486
This commit is contained in:
Takashi NATSUME
2017-07-26 11:24:47 +09:00
parent 3e0ac73abc
commit 6071f6f1b2
2 changed files with 11 additions and 2 deletions

View File

@@ -28,8 +28,14 @@ class TestOsServicesNovaClientV211(test_os_services.TestOsServicesNovaClient):
# to find them. So filter out anything that's not nova-compute.
if serv.binary != 'nova-compute':
continue
host = self._get_column_value_from_single_row_table(
self.nova('service-list --binary %s' % serv.binary), 'Host')
service_list = self.nova('service-list --binary %s' % serv.binary)
# Check the 'service-list' table has the 'Forced down' column
status = self._get_column_value_from_single_row_table(
service_list, 'Forced down')
self.assertEqual('False', status)
host = self._get_column_value_from_single_row_table(service_list,
'Host')
service = self.nova('service-force-down %s %s'
% (host, serv.binary))
self.addCleanup(self.nova, 'service-force-down --unset',

View File

@@ -3471,6 +3471,9 @@ def do_service_list(cs, args):
result = cs.services.list(host=args.host, binary=args.binary)
columns = ["Id", "Binary", "Host", "Zone", "Status",
"State", "Updated_at", "Disabled Reason"]
if cs.api_version >= api_versions.APIVersion('2.11'):
columns.append("Forced down")
utils.print_list(result, columns)