Add support for showing requested az in output
This change adds support for showing the availability zone requested during instance create in server show and server list --long output. Depends-On: https://review.opendev.org/c/openstack/nova/+/904568 Depends-On: https://review.opendev.org/c/openstack/openstacksdk/+/904490 Change-Id: I1772e06b4f043ef3118f036f3908ec70515144bd
This commit is contained in:
parent
03da934605
commit
a1f7bd28e6
openstackclient
@ -180,6 +180,7 @@ def _prep_server_detail(compute_client, image_client, server, refresh=True):
|
||||
'updated_at': 'updated',
|
||||
'user_data': 'OS-EXT-SRV-ATTR:user_data',
|
||||
'vm_state': 'OS-EXT-STS:vm_state',
|
||||
'pinned_availability_zone': 'pinned_availability_zone',
|
||||
}
|
||||
# Some columns returned by openstacksdk should not be shown because they're
|
||||
# either irrelevant or duplicates
|
||||
@ -2753,11 +2754,13 @@ class ListServer(command.Lister):
|
||||
if parsed_args.long:
|
||||
columns += (
|
||||
'availability_zone',
|
||||
'pinned_availability_zone',
|
||||
'hypervisor_hostname',
|
||||
'metadata',
|
||||
)
|
||||
column_headers += (
|
||||
'Availability Zone',
|
||||
'Pinned Availability Zone',
|
||||
'Host',
|
||||
'Properties',
|
||||
)
|
||||
@ -2792,6 +2795,12 @@ class ListServer(command.Lister):
|
||||
if c in ('Availability Zone', "availability_zone"):
|
||||
columns += ('availability_zone',)
|
||||
column_headers += ('Availability Zone',)
|
||||
if c in (
|
||||
'pinned_availability_zone',
|
||||
"Pinned Availability Zone",
|
||||
):
|
||||
columns += ('Pinned Availability Zone',)
|
||||
column_headers += ('Pinned Availability Zone',)
|
||||
if c in ('Host', "host"):
|
||||
columns += ('hypervisor_hostname',)
|
||||
column_headers += ('Host',)
|
||||
|
@ -4644,6 +4644,7 @@ class _TestServerList(TestServer):
|
||||
'Flavor Name',
|
||||
'Flavor ID',
|
||||
'Availability Zone',
|
||||
'Pinned Availability Zone',
|
||||
'Host',
|
||||
'Properties',
|
||||
)
|
||||
@ -4785,6 +4786,7 @@ class TestServerList(_TestServerList):
|
||||
self.flavor.name,
|
||||
s.flavor['id'],
|
||||
getattr(s, 'availability_zone'),
|
||||
getattr(s, 'pinned_availability_zone', ''),
|
||||
server.HostColumn(getattr(s, 'hypervisor_hostname')),
|
||||
format_columns.DictColumn(s.metadata),
|
||||
)
|
||||
@ -4830,6 +4832,8 @@ class TestServerList(_TestServerList):
|
||||
'-c',
|
||||
'Availability Zone',
|
||||
'-c',
|
||||
'Pinned Availability Zone',
|
||||
'-c',
|
||||
'Host',
|
||||
'-c',
|
||||
'Properties',
|
||||
@ -4852,6 +4856,7 @@ class TestServerList(_TestServerList):
|
||||
self.assertIn('Image ID', columns)
|
||||
self.assertIn('Flavor ID', columns)
|
||||
self.assertIn('Availability Zone', columns)
|
||||
self.assertIn('Pinned Availability Zone', columns)
|
||||
self.assertIn('Host', columns)
|
||||
self.assertIn('Properties', columns)
|
||||
self.assertCountEqual(columns, set(columns))
|
||||
@ -5264,6 +5269,7 @@ class TestServerList(_TestServerList):
|
||||
self.flavor.name,
|
||||
s.flavor['id'],
|
||||
getattr(s, 'availability_zone'),
|
||||
getattr(s, 'pinned_availability_zone', ''),
|
||||
server.HostColumn(getattr(s, 'hypervisor_hostname')),
|
||||
format_columns.DictColumn(s.metadata),
|
||||
)
|
||||
@ -5318,6 +5324,7 @@ class TestServerList(_TestServerList):
|
||||
self.flavor.name,
|
||||
s.flavor['id'],
|
||||
getattr(s, 'availability_zone'),
|
||||
getattr(s, 'pinned_availability_zone', ''),
|
||||
server.HostColumn(getattr(s, 'hypervisor_hostname')),
|
||||
format_columns.DictColumn(s.metadata),
|
||||
s.host_status,
|
||||
@ -5354,6 +5361,7 @@ class TestServerListV273(_TestServerList):
|
||||
'Image ID',
|
||||
'Flavor',
|
||||
'Availability Zone',
|
||||
'Pinned Availability Zone',
|
||||
'Host',
|
||||
'Properties',
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user