Allow display project-id for server groups

Currently, the display of server groups doesn't contain informations
about project-id. It is very difficult for admin to tell which
group belongs to which project when using command:
"nova server-group-list --all-projects".

This patch adds project-id to the display.

Change-Id: I010bf02f696396c404bc7a51ce93252c8c7f68a6
Partial-bug:#1481210
This commit is contained in:
Kevin_Zheng 2015-08-04 19:43:47 +08:00 committed by Zhenyu Zheng
parent d0af5f5e98
commit 01c2e60eb3
2 changed files with 9 additions and 2 deletions

View File

@ -2471,7 +2471,8 @@ class ShellTest(utils.TestCase):
self.run_command('server-group-create wjsg affinity')
self.assert_called('POST', '/os-server-groups',
{'server_group': {'name': 'wjsg',
'policies': ['affinity']}})
'policies': ['affinity']}},
pos=0)
def test_delete_multi_server_groups(self):
self.run_command('server-group-delete 12345 56789')

View File

@ -4422,7 +4422,13 @@ def do_availability_zone_list(cs, _args):
def _print_server_group_details(server_group):
columns = ['Id', 'Name', 'Policies', 'Members', 'Metadata']
# This is for compatible with Nova v2 API, remove after v2
# is dropped.
if hasattr(server_group, 'project_id'):
columns = ['Id', 'Name', 'Project_id', 'Policies',
'Members', 'Metadata']
else:
columns = ['Id', 'Name', 'Policies', 'Members', 'Metadata']
utils.print_list(server_group, columns)