summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TESTING.rst2
-rw-r--r--doc/source/devref/provisioning_blocks.rst12
-rw-r--r--neutron/plugins/ml2/driver_context.py16
3 files changed, 15 insertions, 15 deletions
diff --git a/TESTING.rst b/TESTING.rst
index 4568eaa..662b31c 100644
--- a/TESTING.rst
+++ b/TESTING.rst
@@ -679,6 +679,4 @@ with pdb::
679References 679References
680~~~~~~~~~~ 680~~~~~~~~~~
681 681
682.. [#pudb] PUDB debugger:
683 https://pypi.python.org/pypi/pudb
684.. _file-based-sqlite: http://lists.openstack.org/pipermail/openstack-dev/2016-July/099861.html 682.. _file-based-sqlite: http://lists.openstack.org/pipermail/openstack-dev/2016-July/099861.html
diff --git a/doc/source/devref/provisioning_blocks.rst b/doc/source/devref/provisioning_blocks.rst
index e5f764c..ed8ef8d 100644
--- a/doc/source/devref/provisioning_blocks.rst
+++ b/doc/source/devref/provisioning_blocks.rst
@@ -32,8 +32,10 @@ When that entity has finishing provisioning, we just update the STATUS
32directly to active. However, there are resources in Neutron that require 32directly to active. However, there are resources in Neutron that require
33provisioning by multiple asynchronous entities before they are ready to 33provisioning by multiple asynchronous entities before they are ready to
34be used so managing the transition to the ACTIVE status becomes more 34be used so managing the transition to the ACTIVE status becomes more
35complex. To handle these cases, Neutron has the provisioning_blocks 35complex. To handle these cases, Neutron has `the provisioning_blocks
36module to track the entities that are still provisioning a resource. 36module
37<http://git.openstack.org/cgit/openstack/neutron/tree/neutron/db/provisioning_blocks.py>`_
38to track the entities that are still provisioning a resource.
37 39
38The main example of this is with ML2, the L2 agents and the DHCP agents. 40The main example of this is with ML2, the L2 agents and the DHCP agents.
39When a port is created and bound to a host, it's placed in the DOWN 41When a port is created and bound to a host, it's placed in the DOWN
@@ -151,9 +153,3 @@ the port is deleted or it is successful.
151If an ML2 driver immediately places a bound port in the ACTIVE state 153If an ML2 driver immediately places a bound port in the ACTIVE state
152(e.g. after calling a backend in update_port_postcommit), this patch 154(e.g. after calling a backend in update_port_postcommit), this patch
153will not have any impact on that process. 155will not have any impact on that process.
154
155
156References
157----------
158
159.. [#] Provisioning Blocks Module: http://git.openstack.org/cgit/openstack/neutron/tree/neutron/db/provisioning_blocks.py
diff --git a/neutron/plugins/ml2/driver_context.py b/neutron/plugins/ml2/driver_context.py
index f050313..d18bb25 100644
--- a/neutron/plugins/ml2/driver_context.py
+++ b/neutron/plugins/ml2/driver_context.py
@@ -38,12 +38,15 @@ class MechanismDriverContext(object):
38class NetworkContext(MechanismDriverContext, api.NetworkContext): 38class NetworkContext(MechanismDriverContext, api.NetworkContext):
39 39
40 def __init__(self, plugin, plugin_context, network, 40 def __init__(self, plugin, plugin_context, network,
41 original_network=None): 41 original_network=None, segments=None):
42 super(NetworkContext, self).__init__(plugin, plugin_context) 42 super(NetworkContext, self).__init__(plugin, plugin_context)
43 self._network = network 43 self._network = network
44 self._original_network = original_network 44 self._original_network = original_network
45 self._segments = segments_db.get_network_segments( 45 if segments is None:
46 plugin_context.session, network['id']) 46 self._segments = segments_db.get_network_segments(
47 plugin_context.session, network['id'])
48 else:
49 self._segments = segments
47 50
48 @property 51 @property
49 def current(self): 52 def current(self):
@@ -88,8 +91,11 @@ class PortContext(MechanismDriverContext, api.PortContext):
88 super(PortContext, self).__init__(plugin, plugin_context) 91 super(PortContext, self).__init__(plugin, plugin_context)
89 self._port = port 92 self._port = port
90 self._original_port = original_port 93 self._original_port = original_port
91 self._network_context = NetworkContext(plugin, plugin_context, 94 if isinstance(network, NetworkContext):
92 network) if network else None 95 self._network_context = network
96 else:
97 self._network_context = NetworkContext(
98 plugin, plugin_context, network) if network else None
93 self._binding = binding 99 self._binding = binding
94 self._binding_levels = binding_levels 100 self._binding_levels = binding_levels
95 self._segments_to_bind = None 101 self._segments_to_bind = None