Fix NVP L3 gateway ports admin_state_down on creation
Some of the transaction code that was added was removed in the L3 patch for nvp. This reintroduced the logic where ports would be created in the quantum db with admin_state_up=False. This caused L3 gateway patch ports to be created with admin_state_up=False. Fixes bug 1122563 Change-Id: Ifc52eab8665e41d64975856e4693b6ed91bc5b45
This commit is contained in:
parent
50cd5255e8
commit
33c0c9d73e
@ -1097,14 +1097,6 @@ class NvpPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
|
|||||||
self.port_security_enabled_create)
|
self.port_security_enabled_create)
|
||||||
port_data = port['port']
|
port_data = port['port']
|
||||||
with context.session.begin(subtransactions=True):
|
with context.session.begin(subtransactions=True):
|
||||||
# Set admin_state_up False since not created in NVP set
|
|
||||||
# TODO(salvatore-orlando) : verify whether subtransactions can help
|
|
||||||
# us avoiding multiple operations on the db. This might also allow
|
|
||||||
# us to use the same identifier for the NVP and the Quantum port
|
|
||||||
# Set admin_state_up False since not created in NVP yet
|
|
||||||
requested_admin_state = port["port"]["admin_state_up"]
|
|
||||||
port["port"]["admin_state_up"] = False
|
|
||||||
|
|
||||||
# First we allocate port in quantum database
|
# First we allocate port in quantum database
|
||||||
quantum_db = super(NvpPluginV2, self).create_port(context, port)
|
quantum_db = super(NvpPluginV2, self).create_port(context, port)
|
||||||
# If we have just created a dhcp port, and metadata request are
|
# If we have just created a dhcp port, and metadata request are
|
||||||
@ -1137,26 +1129,17 @@ class NvpPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
|
|||||||
# Fetch the network and network binding from Quantum db
|
# Fetch the network and network binding from Quantum db
|
||||||
try:
|
try:
|
||||||
port_data = port['port'].copy()
|
port_data = port['port'].copy()
|
||||||
port_data['admin_state_up'] = requested_admin_state
|
|
||||||
port_create_func = self._port_drivers['create'].get(
|
port_create_func = self._port_drivers['create'].get(
|
||||||
port_data['device_owner'],
|
port_data['device_owner'],
|
||||||
self._port_drivers['create']['default'])
|
self._port_drivers['create']['default'])
|
||||||
|
|
||||||
port_create_func(context, port_data)
|
port_create_func(context, port_data)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
# failed to create port in NVP - Delete port from quantum_db
|
|
||||||
# FIXME (arosen) or the plugin_interface call failed in which
|
# FIXME (arosen) or the plugin_interface call failed in which
|
||||||
# case we need to garbage collect the left over port in nvp.
|
# case we need to garbage collect the left over port in nvp.
|
||||||
err_msg = _("An exception occured while plugging the "
|
err_msg = _("Unable to create port or set port attachment "
|
||||||
"interface in NVP for port %s") % port_data['id']
|
"in NVP.")
|
||||||
LOG.exception(err_msg)
|
LOG.exception(err_msg)
|
||||||
try:
|
|
||||||
super(NvpPluginV2, self).delete_port(context,
|
|
||||||
port['port']['id'])
|
|
||||||
except q_exc.PortNotFound:
|
|
||||||
LOG.warning(_("The delete port operation failed for %s. "
|
|
||||||
"This means the port was already deleted"),
|
|
||||||
port['port']['id'])
|
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
LOG.debug(_("create_port completed on NVP for tenant "
|
LOG.debug(_("create_port completed on NVP for tenant "
|
||||||
|
Loading…
Reference in New Issue
Block a user