Neutron DHCP implementation to raise exception if no ports have VIF

Currently only warning is risen, though deploy can't succeed in this
case for both PXE and Agent drivers.

Change-Id: If57a33818f5da820277c94b7b0ae642d29a698ce
Closes-Bug: #1362060
This commit is contained in:
Dmitry Tantsur 2014-09-22 14:24:48 +02:00
parent efd63cbf53
commit a3c4c80bbf
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')