summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2014-09-01 02:17:28 +0000
committerGerrit Code Review <review@openstack.org>2014-09-01 02:17:28 +0000
commitcde6a03d2ab9c79688c3531014dbfa752ef8f874 (patch)
treef0f82ca6376799eda83827f67847d61893fa9cd8
parent6c38103e095dbf107bdb199979be8e5e909d7e74 (diff)
parent0fcedae747f257e2424b669ec65f32b76f12155a (diff)
downloadneutron-cde6a03d2ab9c79688c3531014dbfa752ef8f874.tar.gz
Merge "Networks are not scheduled to DHCP agents for Cisco N1KV plugin"
-rw-r--r--neutron/plugins/cisco/n1kv/n1kv_neutron_plugin.py4
-rw-r--r--neutron/tests/unit/cisco/n1kv/test_n1kv_plugin.py11
2 files changed, 15 insertions, 0 deletions
diff --git a/neutron/plugins/cisco/n1kv/n1kv_neutron_plugin.py b/neutron/plugins/cisco/n1kv/n1kv_neutron_plugin.py
index dbb3cf1540..7889125b9f 100644
--- a/neutron/plugins/cisco/n1kv/n1kv_neutron_plugin.py
+++ b/neutron/plugins/cisco/n1kv/n1kv_neutron_plugin.py
@@ -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):
diff --git a/neutron/tests/unit/cisco/n1kv/test_n1kv_plugin.py b/neutron/tests/unit/cisco/n1kv/test_n1kv_plugin.py
index 989f724c99..5614b6bb89 100644
--- a/neutron/tests/unit/cisco/n1kv/test_n1kv_plugin.py
+++ b/neutron/tests/unit/cisco/n1kv/test_n1kv_plugin.py
@@ -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):