Show availability_zone info in CLI neutron agent-list
Like nova service-list, we should show availability zone information in agent-list result. It will leave empty if the agent is not belong to any zone. Change-Id: I210b3668c247f06b0c14debe22409ce99836e024 Partially-implements: blueprint add-availability-zone
This commit is contained in:
parent
2ccf62fc44
commit
7d838f1933
@ -29,8 +29,8 @@ class ListAgent(neutronV20.ListCommand):
|
||||
"""List agents."""
|
||||
|
||||
resource = 'agent'
|
||||
list_columns = ['id', 'agent_type', 'host', 'alive', 'admin_state_up',
|
||||
'binary']
|
||||
list_columns = ['id', 'agent_type', 'host', 'availability_zone', 'alive',
|
||||
'admin_state_up', 'binary']
|
||||
_formatters = {'heartbeat_timestamp': _format_timestamp}
|
||||
sorting_support = True
|
||||
|
||||
|
@ -54,6 +54,22 @@ class CLITestV20Agent(test_cli20.CLITestV20Base):
|
||||
self.assertIn("alive", ag.keys())
|
||||
self.assertIn(smile, ag.values())
|
||||
|
||||
def test_list_agents_zone_field(self):
|
||||
contents = {'agents': [{'availability_zone': 'myzone'}]}
|
||||
args = ['-f', 'json']
|
||||
resources = "agents"
|
||||
|
||||
cmd = agent.ListAgent(test_cli20.MyApp(sys.stdout), None)
|
||||
self._test_list_columns(cmd, resources, contents, args)
|
||||
_str = self.fake_stdout.make_string()
|
||||
|
||||
returned_agents = jsonutils.loads(_str)
|
||||
self.assertEqual(1, len(returned_agents))
|
||||
ag = returned_agents[0]
|
||||
self.assertEqual(1, len(ag))
|
||||
self.assertIn("availability_zone", ag.keys())
|
||||
self.assertIn('myzone', ag.values())
|
||||
|
||||
def test_update_agent(self):
|
||||
# agent-update myid --admin-state-down --description mydescr.
|
||||
resource = 'agent'
|
||||
|
Loading…
Reference in New Issue
Block a user