After enabling authN, creating a second network for 'default' tenant fails

Bug #962853 reported by Deepak Garg
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Critical
dan wendlandt
quantum (Ubuntu)
Fix Released
Undecided
Unassigned
Nominated for Precise by Yolanda Robla

Bug Description

After enabling authN in quantum.conf, the authentication is working perfectly - verified with some test cmds.

Steps to reproduce:
a. enable authN in quantum.conf
b. restart quantum service
c. feed the OS env variables and get token $ keystone token-get
d. create a network -> $ quantum -t <token-id> create_net default net2

On the terminal screen, the error you get is:
An unexpected exception occured:unsupported operand type(s) for +: 'int' and 'str' (<type 'exceptions.TypeError'>)

On the quantum screen session, the traceback is:
http://paste.openstack.org/show/12059/

However, the value is reflected in the db.

Please note:
a. Without AuthN enabled, we dont get the traceback
b. I get the traceback only when the 2nd network is created for the 'default' tenant, creating more networks work fine

I have tested it twice with a new devstack install.

Revision history for this message
Salvatore Orlando (salvatore-orlando) wrote :

Hi Deepak,

it seems this failure is peculiar to the OVS plugin. It would be interesting if you can provide some more context in order to understand why it happens only when authentication is enabled.

As far as I recall, the authentication token is consumed in the API layer, and not forwarded to the plugin.

Revision history for this message
Deepak Garg (deepak.garg) wrote :

I didn't dig into it, anything specific you want me to look into.
Yes, the auth token is consumed and the request is passed pretty much the way it was.

Revision history for this message
Rohit Agarwalla (rohitagarwalla) wrote :

>On the terminal screen, the error you get is:
>An unexpected exception occured:unsupported operand type(s) for +: 'int' and 'str' (<type 'exceptions.TypeError'>)

Probably tangential to the core issue here, but I have a fix to get the proper error message. Should I checkin against the same bug id ?

Revision history for this message
Deepak Garg (deepak.garg) wrote :

If you can reproduce and 'confirm' the bug, you should totally go ahead.
Lest you should speak to Dan or Netstack list

Revision history for this message
Rohit Agarwalla (rohitagarwalla) wrote :

Unfortunately, I dont have a OVS setup to reproduce the issue. Let me try to catch Dan.

Revision history for this message
dan wendlandt (danwent) wrote :

Hi all. I've seen this issue before, but chalked it up to stale data left over in the DB. I will take another look.

Changed in quantum:
assignee: nobody → dan wendlandt (danwent)
Revision history for this message
dan wendlandt (danwent) wrote :

Looks like the issue was introduced with the change to "optimize" vlan allocation using a set of free vlans :)

This fix should be easy.

Rohit, were you planning on fixing the issue with the bad error message on the client? If so, yes, please create another bug on that, so we can track it separately.

Changed in quantum:
status: New → Confirmed
importance: Undecided → Critical
Revision history for this message
dan wendlandt (danwent) wrote :

have to run to a meeting right now, but here's the diff:

diff --git a/quantum/plugins/openvswitch/ovs_quantum_plugin.py b/quantum/plugins
index c5091c5..ed29132 100644
--- a/quantum/plugins/openvswitch/ovs_quantum_plugin.py
+++ b/quantum/plugins/openvswitch/ovs_quantum_plugin.py
@@ -50,6 +50,10 @@ class VlanMap(object):
         self.net_ids.clear()
         self.free_vlans = set(xrange(2, 4094))

+ def already_used(self, vlan_id, network_id):
+ self.free_vlans.remove(vlan_id)
+ self.set_vlan(vlan_id, network_id)
+
     def set_vlan(self, vlan_id, network_id):
         self.vlans[vlan_id] = network_id
         self.net_ids[network_id] = vlan_id
@@ -58,7 +62,7 @@ class VlanMap(object):
         if len(self.free_vlans):
             vlan = self.free_vlans.pop()
             self.set_vlan(vlan, network_id)
- # LOG.debug("VlanMap::acquire %s -> %s", x, network_id)
+ LOG.info("VlanMap::acquire %s -> %s", vlan, network_id)
             return vlan
         else:
             raise Exception("No free vlans..")
@@ -72,7 +76,7 @@ class VlanMap(object):
             self.free_vlans.add(vlan)
             del self.vlans[vlan]
             del self.net_ids[network_id]
- # LOG.debug("VlanMap::release %s", vlan)
+ LOG.info("VlanMap::release %s", vlan)
         else:
             LOG.error("No vlan found with network \"%s\"", network_id)

@@ -103,9 +107,9 @@ class OVSQuantumPlugin(QuantumPluginBase):
         vlans = ovs_db.get_vlans()
         for x in vlans:
             vlan_id, network_id = x
- # LOG.debug("Adding already populated vlan %s -> %s"
- # % (vlan_id, network_id))
- self.vmap.set_vlan(vlan_id, network_id)
+ LOG.info("Adding already populated vlan %s -> %s"
+ % (vlan_id, network_id))
+ self.vmap.already_used(vlan_id, network_id)

     def get_all_networks(self, tenant_id, **kwargs):
         nets = []

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to quantum (master)

Fix proposed to branch: master
Review: https://review.openstack.org/5753

Changed in quantum:
status: Confirmed → In Progress
Revision history for this message
dan wendlandt (danwent) wrote :

Note: I have a patch for the client side issue, bug file here: https://bugs.launchpad.net/quantum/+bug/963494

tags: added: essex-rc-potential
dan wendlandt (danwent)
Changed in quantum:
milestone: none → essex-rc2
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to quantum (master)

Reviewed: https://review.openstack.org/5753
Committed: http://github.com/openstack/quantum/commit/540f1eda0b5568795b501e44de44c9392ceb7f17
Submitter: Jenkins
Branch: master

commit 540f1eda0b5568795b501e44de44c9392ceb7f17
Author: Dan Wendlandt <email address hidden>
Date: Mon Apr 2 20:14:37 2012 -0700

    fix issue with OVS plugin VLAN allocation after a quantum-server restart

    bug 962853

    Also use constants for VLAN_MIN/VLAN_MAX and clean-up VlanMap unit tests.

    Change-Id: Id7b580d604092b5fc16d4c87ae866d419aad4d1f

Changed in quantum:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to quantum (milestone-proposed)

Fix proposed to branch: milestone-proposed
Review: https://review.openstack.org/6131

Changed in quantum:
status: Fix Committed → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to quantum (milestone-proposed)

Reviewed: https://review.openstack.org/6131
Committed: http://github.com/openstack/quantum/commit/e587b405fd2e7396bd7968be64ed76e858185da5
Submitter: Jenkins
Branch: milestone-proposed

commit e587b405fd2e7396bd7968be64ed76e858185da5
Author: Dan Wendlandt <email address hidden>
Date: Mon Apr 2 20:14:37 2012 -0700

    fix issue with OVS plugin VLAN allocation after a quantum-server restart

    bug 962853

    Also use constants for VLAN_MIN/VLAN_MAX and clean-up VlanMap unit tests.

    Change-Id: Id7b580d604092b5fc16d4c87ae866d419aad4d1f

Thierry Carrez (ttx)
Changed in quantum:
milestone: essex-rc2 → 2012.1
Changed in quantum (Ubuntu):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.