sqlalchemy could not parse sql_connection urls containning ipv6 address

Bug #1190454 reported by Wang Bo
14
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Won't Fix
Low
Unassigned
oslo-incubator
Invalid
Undecided
Davanum Srinivas (DIMS)

Bug Description

Version of Nova: Grizzly.

I tried to configure openstack in pure IPv6 enviroment.

 Edit nova.conf file in controller node.
 Set the sql_connection = msyql://nova:nova@[2001:db8::22]/nova?charset=utf8 ( [2001:db8::22] is ipv6 address of controller node)

When started the service nova-conductor (or any other project connected to database), It reported ERROR.
In File: /usr/lib64/python2.6/site-packages/sqlalchemy/engine/url.py
  Function : def _parse_rfc1738_args(name):
                           pattern = re.compile(r'''
                              (?P<name>[\w\+]+)://
                              (?:
                              (?P<username>[^:/]*)
                              (?::(?P<password>[^/]*))?
                              @)?
                              (?:
                              (?P<host>[^/:]*)
                              (?::(?P<port>[^/]*))?
                              )?
                              (?:/(?P<database>.*))?
                              '''
                              , re.X)

                          m = pattern.match(name)
                               if m is not None:
                                    components = m.groupdict()

Add breakpoint in above code and debug to get the components. Result of components is following:
{ 'username': 'nova', 'name': 'mysql', 'database':'nova?charset=utf8', 'host': '[2001', 'password':'nova', 'port' : 'db8::22]' }

Obviously, the current code could not parse sql_connection urls that contain ipv6 address correctly.

Tags: db
Wang Bo (chestack)
description: updated
Revision history for this message
Matt Riedemann (mriedem) wrote :

Which version of sqlalchemy do you have installed?

This might be unrelated, but I see you're running on python 2.6 and wanted to point out that the built in url parsing support for IPv6 didn't show up until python 2.7:

http://docs.python.org/2.7/library/urlparse.html

Revision history for this message
Wang Bo (chestack) wrote :

Reply to #1, Thanks for your comments.

Version of installed sqlalchemy : 0.7.9.

I know that urlparse.py added ipv6 url parsing capabilities in python 2.7. But this bug is about sqlalchemy. OpenStack use url.py (sqlalchemy/engine/url.py) but not urlparse.py to connect DB. The following is home page of sqlalchemy: http://www.sqlalchemy.org/

The lastest version is 0.8 which still do not support ipv6.

tags: added: db
David Ripton (dripton)
Changed in nova:
status: New → Confirmed
importance: Undecided → Medium
importance: Medium → Low
Revision history for this message
David Ripton (dripton) wrote :

This is a real bug, but unfortunately it's in SQLAlchemy, so OpenStack can't fix it directly without dumping SQLAlchemy, which would be a drastic change. Please report the bug to SQLAlchemy, though, so they are aware that there are people who'd like them to support IPv6 addresses in their connection URLs.

As a workaround, you can give the box 2001:db8::22 a DNS entry or hosts file entry and refer to it by hostname rather than IPv6 address.

Changed in nova:
status: Confirmed → Won't Fix
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to oslo-incubator (master)

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

Changed in oslo:
assignee: nobody → Davanum Srinivas (DIMS) (dims-v)
status: New → In Progress
Revision history for this message
Wei Hu (huwei-xtu) wrote :

Sqlalchemy has fixed the bug. And I have tried it, it does work.
http://www.sqlalchemy.org/trac/ticket/2851#comment:4

Revision history for this message
Davanum Srinivas (DIMS) (dims-v) wrote :

Fixed upstream

Changed in oslo:
status: In Progress → Invalid
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.