Merge "Neutron DHCP implementation to raise exception if no ports have VIF"

This commit is contained in:
Jenkins 2014-09-22 19:28:07 +00:00 committed by Gerrit Code Review
commit 4674aef9e4
2 changed files with 6 additions and 5 deletions

View File

@ -145,10 +145,10 @@ class NeutronDHCPApi(base.BaseDHCP):
""" """
vifs = network.get_node_vif_ids(task) vifs = network.get_node_vif_ids(task)
if not vifs: if not vifs:
LOG.warning(_LW("No VIFs found for node %(node)s when attempting " raise exception.FailedToUpdateDHCPOptOnPort(
"to update DHCP BOOT options."), _("No VIFs found for node %(node)s when attempting "
{'node': task.node.uuid}) "to update DHCP BOOT options.") %
return {'node': task.node.uuid})
failures = [] failures = []
for port_id, port_vif in vifs.items(): for port_id, port_vif in vifs.items():

View File

@ -180,7 +180,8 @@ class TestNeutron(base.TestCase):
with task_manager.acquire(self.context, with task_manager.acquire(self.context,
self.node.uuid) as task: self.node.uuid) as task:
api = dhcp_factory.DHCPFactory() api = dhcp_factory.DHCPFactory()
api.update_dhcp(task, self.node) self.assertRaises(exception.FailedToUpdateDHCPOptOnPort,
api.update_dhcp, task, self.node)
self.assertFalse(mock_updo.called) self.assertFalse(mock_updo.called)
@mock.patch('ironic.dhcp.neutron.NeutronDHCPApi.update_port_dhcp_opts') @mock.patch('ironic.dhcp.neutron.NeutronDHCPApi.update_port_dhcp_opts')