class TypeManager(stevedore.named.NamedExtensionManager):
"""Manage network segment types using drivers."""
- # Mapping from type name to DriverManager
- drivers = {}
-
def __init__(self):
# REVISIT(rkukura): Need way to make stevedore use our logging
# configuration. Currently, nothing is logged if loading a
# driver fails.
+ # Mapping from type name to DriverManager
+ self.drivers = {}
LOG.info(_("Configured type driver names: %s"),
cfg.CONF.ml2.type_drivers)
super(TypeManager, self).__init__('neutron.ml2.type_drivers',
# TODO(apech): add calls for subnets
- # Registered mechanism drivers, keyed by name.
- mech_drivers = {}
- # Ordered list of mechanism drivers, defining
- # the order in which the drivers are called.
- ordered_mech_drivers = []
-
def __init__(self):
# REVISIT(rkukura): Need way to make stevedore use our logging
# configuration. Currently, nothing is logged if loading a
# driver fails.
+ # Registered mechanism drivers, keyed by name.
+ self.mech_drivers = {}
+ # Ordered list of mechanism drivers, defining
+ # the order in which the drivers are called.
+ self.ordered_mech_drivers = []
+
LOG.info(_("Configured mechanism driver names: %s"),
cfg.CONF.ml2.mechanism_drivers)
super(MechanismManager, self).__init__('neutron.ml2.mechanism_drivers',
constructor.
"""
for ext in self:
- if ext.name in self.mech_drivers:
- LOG.error(_("Mechanism driver '%s' ignored because "
- "driver is already registered"),
- ext.name)
- else:
- self.mech_drivers[ext.name] = ext
- self.ordered_mech_drivers.append(ext)
+ self.mech_drivers[ext.name] = ext
+ self.ordered_mech_drivers.append(ext)
LOG.info(_("Registered mechanism drivers: %s"),
[driver.name for driver in self.ordered_mech_drivers])
)
def create_network_precommit(self, context):
- """Notify all mechanism drivers of a network creation.
+ """Notify all mechanism drivers during network creation.
:raises: neutron.plugins.ml2.common.MechanismDriverError
if any mechanism driver create_network_precommit call fails.
self._call_on_drivers("create_network_precommit", context)
def create_network_postcommit(self, context):
- """Notify all mechanism drivers of network creation.
+ """Notify all mechanism drivers after network creation.
:raises: neutron.plugins.ml2.common.MechanismDriverError
if any mechanism driver create_network_postcommit call fails.
self._call_on_drivers("create_network_postcommit", context)
def update_network_precommit(self, context):
- """Notify all mechanism drivers of a network update.
+ """Notify all mechanism drivers during network update.
:raises: neutron.plugins.ml2.common.MechanismDriverError
if any mechanism driver update_network_precommit call fails.
self._call_on_drivers("update_network_precommit", context)
def update_network_postcommit(self, context):
- """Notify all mechanism drivers of a network update.
+ """Notify all mechanism drivers after network update.
:raises: neutron.plugins.ml2.common.MechanismDriverError
if any mechanism driver update_network_postcommit call fails.
self._call_on_drivers("update_network_postcommit", context)
def delete_network_precommit(self, context):
- """Notify all mechanism drivers of a network deletion.
+ """Notify all mechanism drivers during network deletion.
:raises: neutron.plugins.ml2.common.MechanismDriverError
if any mechanism driver delete_network_precommit call fails.
self._call_on_drivers("delete_network_precommit", context)
def delete_network_postcommit(self, context):
- """Notify all mechanism drivers of a network deletion.
+ """Notify all mechanism drivers after network deletion.
:raises: neutron.plugins.ml2.common.MechanismDriverError
if any mechanism driver delete_network_postcommit call fails.
continue_on_failure=True)
def create_subnet_precommit(self, context):
- """Notify all mechanism drivers of a subnet creation.
+ """Notify all mechanism drivers during subnet creation.
:raises: neutron.plugins.ml2.common.MechanismDriverError
if any mechanism driver create_subnet_precommit call fails.
self._call_on_drivers("create_subnet_precommit", context)
def create_subnet_postcommit(self, context):
- """Notify all mechanism drivers of subnet creation.
+ """Notify all mechanism drivers after subnet creation.
:raises: neutron.plugins.ml2.common.MechanismDriverError
if any mechanism driver create_subnet_postcommit call fails.
self._call_on_drivers("create_subnet_postcommit", context)
def update_subnet_precommit(self, context):
- """Notify all mechanism drivers of a subnet update.
+ """Notify all mechanism drivers during subnet update.
:raises: neutron.plugins.ml2.common.MechanismDriverError
if any mechanism driver update_subnet_precommit call fails.
self._call_on_drivers("update_subnet_precommit", context)
def update_subnet_postcommit(self, context):
- """Notify all mechanism drivers of a subnet update.
+ """Notify all mechanism drivers after subnet update.
:raises: neutron.plugins.ml2.common.MechanismDriverError
if any mechanism driver update_subnet_postcommit call fails.
self._call_on_drivers("update_subnet_postcommit", context)
def delete_subnet_precommit(self, context):
- """Notify all mechanism drivers of a subnet deletion.
+ """Notify all mechanism drivers during subnet deletion.
:raises: neutron.plugins.ml2.common.MechanismDriverError
if any mechanism driver delete_subnet_precommit call fails.
self._call_on_drivers("delete_subnet_precommit", context)
def delete_subnet_postcommit(self, context):
- """Notify all mechanism drivers of a subnet deletion.
+ """Notify all mechanism drivers after subnet deletion.
:raises: neutron.plugins.ml2.common.MechanismDriverError
if any mechanism driver delete_subnet_postcommit call fails.
continue_on_failure=True)
def create_port_precommit(self, context):
- """Notify all mechanism drivers of a port creation.
+ """Notify all mechanism drivers during port creation.
:raises: neutron.plugins.ml2.common.MechanismDriverError
if any mechanism driver create_port_precommit call fails.
self._call_on_drivers("create_port_postcommit", context)
def update_port_precommit(self, context):
- """Notify all mechanism drivers of a port update.
+ """Notify all mechanism drivers during port update.
:raises: neutron.plugins.ml2.common.MechanismDriverError
if any mechanism driver update_port_precommit call fails.
self._call_on_drivers("update_port_precommit", context)
def update_port_postcommit(self, context):
- """Notify all mechanism drivers of a port update.
+ """Notify all mechanism drivers after port update.
:raises: neutron.plugins.ml2.common.MechanismDriverError
if any mechanism driver update_port_postcommit call fails.
self._call_on_drivers("update_port_postcommit", context)
def delete_port_precommit(self, context):
- """Notify all mechanism drivers of a port deletion.
+ """Notify all mechanism drivers during port deletion.
:raises: neutron.plugins.ml2.common.MechanismDriverError
if any mechanism driver delete_port_precommit call fails.
self._call_on_drivers("delete_port_precommit", context)
def delete_port_postcommit(self, context):
- """Notify all mechanism drivers of a port deletion.
+ """Notify all mechanism drivers after port deletion.
:raises: neutron.plugins.ml2.common.MechanismDriverError
if any mechanism driver delete_port_postcommit call fails.