diff options
author | Takashi NATSUME <natsume.takashi@lab.ntt.co.jp> | 2017-07-26 11:24:47 +0900 |
---|---|---|
committer | Takashi NATSUME <natsume.takashi@lab.ntt.co.jp> | 2017-07-26 12:04:56 +0900 |
commit | 6071f6f1b2a231e3bc5ba5c16e6df7e562e93642 (patch) | |
tree | 485e6fb0f9757ba105a98a6d46d9e34d0dd11fd5 | |
parent | 3e0ac73abc4a7da0e8f40f77c6dc84614e548ddb (diff) | |
download | python-novaclient-6071f6f1b2a231e3bc5ba5c16e6df7e562e93642.tar.gz |
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
-rw-r--r-- | novaclient/tests/functional/v2/test_os_services.py | 10 | ||||
-rw-r--r-- | novaclient/v2/shell.py | 3 |
2 files changed, 11 insertions, 2 deletions
diff --git a/novaclient/tests/functional/v2/test_os_services.py b/novaclient/tests/functional/v2/test_os_services.py index 3da8449c..e12e40ae 100644 --- a/novaclient/tests/functional/v2/test_os_services.py +++ b/novaclient/tests/functional/v2/test_os_services.py @@ -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', diff --git a/novaclient/v2/shell.py b/novaclient/v2/shell.py index 947fc31a..fa74e0b3 100644 --- a/novaclient/v2/shell.py +++ b/novaclient/v2/shell.py @@ -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) |