Merge "Networks are not scheduled to DHCP agents for Cisco N1KV plugin"

This commit is contained in:
Jenkins 2014-09-01 02:17:28 +00:00 committed by Gerrit Code Review
commit c4eafcaba1
2 changed files with 15 additions and 0 deletions

View File

@ -1300,6 +1300,10 @@ 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):

View File

@ -1172,6 +1172,17 @@ class TestN1kvSubnets(test_plugin.TestSubnetsV2,
self.assertEqual(req.get_response(self.api).status_int,
webob.exc.HTTPNoContent.code)
def test_schedule_network_with_subnet_create(self):
"""Test invocation of explicit scheduling for networks."""
with mock.patch.object(n1kv_neutron_plugin.N1kvNeutronPluginV2,
'schedule_network') as mock_method:
# Test with network auto-scheduling disabled
c_conf.CONF.set_override('network_auto_schedule', False)
# Subnet creation should trigger scheduling for networks
with self.subnet():
pass
self.assertEqual(1, mock_method.call_count)
class TestN1kvL3Test(test_l3_plugin.L3NatExtensionTestCase):