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)
if not vifs:
LOG.warning(_LW("No VIFs found for node %(node)s when attempting "
"to update DHCP BOOT options."),
{'node': task.node.uuid})
return
raise exception.FailedToUpdateDHCPOptOnPort(
_("No VIFs found for node %(node)s when attempting "
"to update DHCP BOOT options.") %
{'node': task.node.uuid})
failures = []
for port_id, port_vif in vifs.items():

View File

@ -180,7 +180,8 @@ class TestNeutron(base.TestCase):
with task_manager.acquire(self.context,
self.node.uuid) as task:
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)
@mock.patch('ironic.dhcp.neutron.NeutronDHCPApi.update_port_dhcp_opts')