Merge "Request only instance_uuid in ironic node list"
This commit is contained in:
commit
84ebc21ea7
|
@ -519,13 +519,15 @@ class IronicDriverTestCase(test.NoDBTestCase):
|
|||
instances.append(fake_instance.fake_instance_obj(self.ctx,
|
||||
id=i,
|
||||
uuid=uuid))
|
||||
nodes.append(ironic_utils.get_test_node(instance_uuid=uuid))
|
||||
nodes.append(ironic_utils.get_test_node(instance_uuid=uuid,
|
||||
fields=['instance_uuid']))
|
||||
|
||||
mock_inst_by_uuid.side_effect = instances
|
||||
mock_call.return_value = nodes
|
||||
|
||||
response = self.driver.list_instances()
|
||||
mock_call.assert_called_with("node.list", associated=True, limit=0)
|
||||
mock_call.assert_called_with("node.list", associated=True,
|
||||
fields=['instance_uuid'], limit=0)
|
||||
expected_calls = [mock.call(mock.ANY, instances[0].uuid),
|
||||
mock.call(mock.ANY, instances[1].uuid)]
|
||||
mock_inst_by_uuid.assert_has_calls(expected_calls)
|
||||
|
@ -538,7 +540,8 @@ class IronicDriverTestCase(test.NoDBTestCase):
|
|||
mock_call.side_effect = exception.NovaException
|
||||
self.assertRaises(exception.VirtDriverNotReady,
|
||||
self.driver.list_instances)
|
||||
mock_call.assert_called_with("node.list", associated=True, limit=0)
|
||||
mock_call.assert_called_with("node.list", associated=True,
|
||||
fields=['instance_uuid'], limit=0)
|
||||
self.assertFalse(mock_inst_by_uuid.called)
|
||||
|
||||
@mock.patch.object(cw.IronicClientWrapper, 'call')
|
||||
|
@ -547,11 +550,13 @@ class IronicDriverTestCase(test.NoDBTestCase):
|
|||
nodes = []
|
||||
for n in range(num_nodes):
|
||||
nodes.append(ironic_utils.get_test_node(
|
||||
instance_uuid=uuidutils.generate_uuid()))
|
||||
instance_uuid=uuidutils.generate_uuid(),
|
||||
fields=['instance_uuid']))
|
||||
|
||||
mock_call.return_value = nodes
|
||||
uuids = self.driver.list_instance_uuids()
|
||||
mock_call.assert_called_with('node.list', associated=True, limit=0)
|
||||
mock_call.assert_called_with('node.list', associated=True,
|
||||
fields=['instance_uuid'], limit=0)
|
||||
expected = [n.instance_uuid for n in nodes]
|
||||
self.assertEqual(sorted(expected), sorted(uuids))
|
||||
|
||||
|
|
|
@ -599,7 +599,8 @@ class IronicDriver(virt_driver.ComputeDriver):
|
|||
"""
|
||||
# NOTE(lucasagomes): limit == 0 is an indicator to continue
|
||||
# pagination until there're no more values to be returned.
|
||||
node_list = self._get_node_list(associated=True, limit=0)
|
||||
node_list = self._get_node_list(associated=True,
|
||||
fields=['instance_uuid'], limit=0)
|
||||
context = nova_context.get_admin_context()
|
||||
return [objects.Instance.get_by_uuid(context,
|
||||
i.instance_uuid).name
|
||||
|
@ -614,8 +615,9 @@ class IronicDriver(virt_driver.ComputeDriver):
|
|||
"""
|
||||
# NOTE(lucasagomes): limit == 0 is an indicator to continue
|
||||
# pagination until there're no more values to be returned.
|
||||
return list(n.instance_uuid
|
||||
for n in self._get_node_list(associated=True, limit=0))
|
||||
node_list = self._get_node_list(associated=True,
|
||||
fields=['instance_uuid'], limit=0)
|
||||
return list(n.instance_uuid for n in node_list)
|
||||
|
||||
def node_is_available(self, nodename):
|
||||
"""Confirms a Nova hypervisor node exists in the Ironic inventory.
|
||||
|
|
Loading…
Reference in New Issue