]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Fix NVP L3 gateway ports admin_state_down on creation
authorAaron Rosen <arosen@nicira.com>
Tue, 12 Feb 2013 00:17:22 +0000 (16:17 -0800)
committerAaron Rosen <arosen@nicira.com>
Tue, 12 Feb 2013 19:30:33 +0000 (11:30 -0800)
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

quantum/plugins/nicira/nicira_nvp_plugin/QuantumPlugin.py

index 00886f17f0ba2faafd74b65e56921fe207803756..dbbfe5c75afbc3a2de554f22ba1445047627e6ef 100644 (file)
@@ -1097,14 +1097,6 @@ class NvpPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
                                    self.port_security_enabled_create)
         port_data = port['port']
         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
             quantum_db = super(NvpPluginV2, self).create_port(context, port)
             # 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
             try:
                 port_data = port['port'].copy()
-                port_data['admin_state_up'] = requested_admin_state
                 port_create_func = self._port_drivers['create'].get(
                     port_data['device_owner'],
                     self._port_drivers['create']['default'])
 
                 port_create_func(context, port_data)
             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
                 # case we need to garbage collect the left over port in nvp.
-                err_msg = _("An exception occured while plugging the "
-                            "interface in NVP for port %s") % port_data['id']
+                err_msg = _("Unable to create port or set port attachment "
+                            "in NVP.")
                 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
 
             LOG.debug(_("create_port completed on NVP for tenant "