Merge "Schedule net to a DHCP agt on subnet create"
This commit is contained in:
commit
8f11581a35
@ -70,8 +70,8 @@ class DhcpAgentNotifyAPI(object):
|
||||
{'network': {'id': network['id']}}, agent['host'])
|
||||
elif not existing_agents:
|
||||
LOG.warn(_LW('Unable to schedule network %s: no agents available; '
|
||||
'will retry on subsequent port creation events.'),
|
||||
network['id'])
|
||||
'will retry on subsequent port and subnet creation '
|
||||
'events.'), network['id'])
|
||||
return new_agents + existing_agents
|
||||
|
||||
def _get_enabled_agents(self, context, network, agents, method, payload):
|
||||
@ -126,6 +126,7 @@ class DhcpAgentNotifyAPI(object):
|
||||
|
||||
# schedule the network first, if needed
|
||||
schedule_required = (
|
||||
method == 'subnet_create_end' or
|
||||
method == 'port_create_end' and
|
||||
not self._is_reserved_dhcp_port(payload['port']))
|
||||
if schedule_required:
|
||||
|
@ -1296,10 +1296,6 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||
self).delete_subnet(context, sub['id'])
|
||||
else:
|
||||
LOG.debug("Created subnet: %s", sub['id'])
|
||||
if not q_conf.CONF.network_auto_schedule:
|
||||
# Schedule network to a DHCP agent
|
||||
net = self.get_network(context, sub['network_id'])
|
||||
self.schedule_network(context, net)
|
||||
return sub
|
||||
|
||||
def update_subnet(self, context, id, subnet):
|
||||
|
@ -139,9 +139,9 @@ class TestDhcpAgentNotifyAPI(base.BaseTestCase):
|
||||
self._test__notify_agents('port_update_end',
|
||||
expected_scheduling=0, expected_casts=1)
|
||||
|
||||
def test__notify_agents_cast_required_wo_scheduling_on_subnet_create(self):
|
||||
def test__notify_agents_cast_required_with_scheduling_subnet_create(self):
|
||||
self._test__notify_agents('subnet_create_end',
|
||||
expected_scheduling=0, expected_casts=1)
|
||||
expected_scheduling=1, expected_casts=1)
|
||||
|
||||
def test__notify_agents_no_action(self):
|
||||
self._test__notify_agents('network_create_end',
|
||||
|
@ -1290,6 +1290,11 @@ class OvsDhcpAgentNotifierTestCase(test_l3_plugin.L3NatTestCaseMixin,
|
||||
'network_create_end',
|
||||
{'network': {'id': net['network']['id']}},
|
||||
host),
|
||||
mock.call(
|
||||
mock.ANY,
|
||||
'subnet_create_end',
|
||||
subnet,
|
||||
host, 'dhcp_agent'),
|
||||
mock.call(
|
||||
mock.ANY,
|
||||
'port_create_end',
|
||||
|
Loading…
Reference in New Issue
Block a user