Show maintenance field in GET /nodes

Before the maintenance field was only shown if client issued a GET on
a specific node (node-show), but this is an important attribute to have
listed in a GET /nodes (node-list), it's a good info to know which nodes
from that list are in maintenance mode or not, and the Nova Ironic Driver
also need this information to determine which nodes are available to be
exposed to Nova or not.

Change-Id: Icc31a312130a1c2d5853da64bd9091a93221363c
This commit is contained in:
Lucas Alvares Gomes 2014-04-02 11:05:31 +01:00
parent 1f1911d768
commit 6010d15f61
2 changed files with 6 additions and 2 deletions

View File

@ -336,7 +336,7 @@ class Node(base.APIBase):
@classmethod
def _convert_with_links(cls, node, url, expand=True):
if not expand:
except_list = ['instance_uuid', 'power_state',
except_list = ['instance_uuid', 'maintenance', 'power_state',
'provision_state', 'uuid']
node.unset_fields_except(except_list)
else:

View File

@ -82,6 +82,11 @@ class TestListNodes(base.FunctionalTest):
ndict = dbutils.get_test_node()
node = self.dbapi.create_node(ndict)
data = self.get_json('/nodes')
self.assertIn('instance_uuid', data['nodes'][0])
self.assertIn('maintenance', data['nodes'][0])
self.assertIn('power_state', data['nodes'][0])
self.assertIn('provision_state', data['nodes'][0])
self.assertIn('uuid', data['nodes'][0])
self.assertEqual(node['uuid'], data['nodes'][0]["uuid"])
self.assertNotIn('driver', data['nodes'][0])
self.assertNotIn('driver_info', data['nodes'][0])
@ -89,7 +94,6 @@ class TestListNodes(base.FunctionalTest):
self.assertNotIn('properties', data['nodes'][0])
self.assertNotIn('chassis_uuid', data['nodes'][0])
self.assertNotIn('reservation', data['nodes'][0])
self.assertNotIn('maintenance', data['nodes'][0])
self.assertNotIn('console_enabled', data['nodes'][0])
self.assertNotIn('target_power_state', data['nodes'][0])
self.assertNotIn('target_provision_state', data['nodes'][0])