Sqlalchemy does not work in ipv6 environment
(original reporter: huwei) Environment: python 2.6 sqlalchemy 0.7.9 redhat 6.4 mysql 5.5.34
In openstack grizzly version, I configured the mysql connection url from ipv4 to ipv6 address(connection=mysql://keystone:keystone@2001:da8:2004:1000:202:116:160:90/keystone?charset=utf). And restart openstack service, but when I use keystone cli to list users. I got an error message "Authorization Failed: KS-117430E An unexpected error prevented the server from fulfilling your request. invalid literal for int() with base 10: 'da8:2004:1000:202:116:160:90]' (HTTP 500)". And the following is the error log information.
2013-10-21 08:14:57.429 25606 ERROR keystone.common.wsgi - invalid literal for int() with base 10: 'da8:2004:1000:202:116:160:90]' 2013-10-21 08:14:57.429 25606 TRACE keystone.common.wsgi Traceback (most recent call last): 2013-10-21 08:14:57.429 25606 TRACE keystone.common.wsgi File "/usr/lib/python2.6/site-packages/keystone/common/wsgi.py", line 238, in call 2013-10-21 08:14:57.429 25606 TRACE keystone.common.wsgi result = method(context, params) 2013-10-21 08:14:57.429 25606 TRACE keystone.common.wsgi File "/usr/lib/python2.6/site-packages/keystone/token/controllers.py", line 94, in authenticate 2013-10-21 08:14:57.429 25606 TRACE keystone.common.wsgi context, auth) 2013-10-21 08:14:57.429 25606 TRACE keystone.common.wsgi File "/usr/lib/python2.6/site-packages/keystone/token/controllers.py", line 257, in _authenticate_local 2013-10-21 08:14:57.429 25606 TRACE keystone.common.wsgi username, DEFAULT_DOMAIN_ID) 2013-10-21 08:14:57.429 25606 TRACE keystone.common.wsgi File "/usr/lib/python2.6/site-packages/keystone/identity/core.py", line 177, in wrapper 2013-10-21 08:14:57.429 25606 TRACE keystone.common.wsgi return f(self, *args, kwargs) 2013-10-21 08:14:57.429 25606 TRACE keystone.common.wsgi File "/usr/lib/python2.6/site-packages/keystone/identity/core.py", line 337, in get_user_by_name 2013-10-21 08:14:57.429 25606 TRACE keystone.common.wsgi driver = self._select_identity_driver(domain_id) 2013-10-21 08:14:57.429 25606 TRACE keystone.common.wsgi File "/usr/lib/python2.6/site-packages/keystone/identity/core.py", line 280, in _select_identity_driver 2013-10-21 08:14:57.429 25606 TRACE keystone.common.wsgi self.get_domain(domain_id) 2013-10-21 08:14:57.429 25606 TRACE keystone.common.wsgi File "/usr/lib/python2.6/site-packages/keystone/identity/core.py", line 538, in get_domain 2013-10-21 08:14:57.429 25606 TRACE keystone.common.wsgi return self.assignment_api.get_domain(domain_id) 2013-10-21 08:14:57.429 25606 TRACE keystone.common.wsgi File "/usr/lib/python2.6/site-packages/dogpile/cache/region.py", line 936, in decorate 2013-10-21 08:14:57.429 25606 TRACE keystone.common.wsgi should_cache_fn) 2013-10-21 08:14:57.429 25606 TRACE keystone.common.wsgi File "/usr/lib/python2.6/site-packages/dogpile/cache/region.py", line 588, in get_or_create 2013-10-21 08:14:57.429 25606 TRACE keystone.common.wsgi async_creator) as value: 2013-10-21 08:14:57.429 25606 TRACE keystone.common.wsgi File "/usr/lib/python2.6/site-packages/dogpile/core/dogpile.py", line 158, in enter 2013-10-21 08:14:57.429 25606 TRACE keystone.common.wsgi return self._enter() 2013-10-21 08:14:57.429 25606 TRACE keystone.common.wsgi File "/usr/lib/python2.6/site-packages/dogpile/core/dogpile.py", line 98, in _enter 2013-10-21 08:14:57.429 25606 TRACE keystone.common.wsgi generated = self._enter_create(createdtime) 2013-10-21 08:14:57.429 25606 TRACE keystone.common.wsgi File "/usr/lib/python2.6/site-packages/dogpile/core/dogpile.py", line 149, in _enter_create 2013-10-21 08:14:57.429 25606 TRACE keystone.common.wsgi created = self.creator() 2013-10-21 08:14:57.429 25606 TRACE keystone.common.wsgi File "/usr/lib/python2.6/site-packages/dogpile/cache/region.py", line 565, in gen_value 2013-10-21 08:14:57.429 25606 TRACE keystone.common.wsgi created_value = creator() 2013-10-21 08:14:57.429 25606 TRACE keystone.common.wsgi File "/usr/lib/python2.6/site-packages/dogpile/cache/region.py", line 932, in creator 2013-10-21 08:14:57.429 25606 TRACE keystone.common.wsgi return fn(arg, kw) 2013-10-21 08:14:57.429 25606 TRACE keystone.common.wsgi File "/usr/lib/python2.6/site-packages/keystone/assignment/core.py", line 262, in get_domain 2013-10-21 08:14:57.429 25606 TRACE keystone.common.wsgi return self.driver.get_domain(domain_id) 2013-10-21 08:14:57.429 25606 TRACE keystone.common.wsgi File "/usr/lib/python2.6/site-packages/keystone/assignment/backends/sql.py", line 525, in get_domain 2013-10-21 08:14:57.429 25606 TRACE keystone.common.wsgi session = self.get_session() 2013-10-21 08:14:57.429 25606 TRACE keystone.common.wsgi File "/usr/lib/python2.6/site-packages/keystone/common/sql/core.py", line 236, in get_session 2013-10-21 08:14:57.429 25606 TRACE keystone.common.wsgi self._engine = self.get_engine() 2013-10-21 08:14:57.429 25606 TRACE keystone.common.wsgi File "/usr/lib/python2.6/site-packages/keystone/common/sql/core.py", line 278, in get_engine 2013-10-21 08:14:57.429 25606 TRACE keystone.common.wsgi engine = new_engine() 2013-10-21 08:14:57.429 25606 TRACE keystone.common.wsgi File "/usr/lib/python2.6/site-packages/keystone/common/sql/core.py", line 251, in new_engine 2013-10-21 08:14:57.429 25606 TRACE keystone.common.wsgi connection_dict = sql.engine.url.make_url(CONF.sql.connection) 2013-10-21 08:14:57.429 25606 TRACE keystone.common.wsgi File "/usr/lib64/python2.6/site-packages/sqlalchemy/engine/url.py", line 178, in make_url 2013-10-21 08:14:57.429 25606 TRACE keystone.common.wsgi return _parse_rfc1738_args(name_or_url) 2013-10-21 08:14:57.429 25606 TRACE keystone.common.wsgi File "/usr/lib64/python2.6/site-packages/sqlalchemy/engine/url.py", line 216, in _parse_rfc1738_args 2013-10-21 08:14:57.429 25606 TRACE keystone.common.wsgi return URL(name, *components) 2013-10-21 08:14:57.429 25606 TRACE keystone.common.wsgi File "/usr/lib64/python2.6/site-packages/sqlalchemy/engine/url.py", line 56, in init 2013-10-21 08:14:57.429 25606 TRACE keystone.common.wsgi self.port = int(port) 2013-10-21 08:14:57.429 25606 TRACE keystone.common.wsgi ValueError: invalid literal for int() with base 10: 'da8:2004:1000:202:116:160:90]'
Comments (6)
-
repo owner -
repo owner - attached 2851.patch
patch is attached, it should patch against 0.7 at least the url.py part, can you give this a try?
-
repo owner this change is trivial so it's back to 0.7:
470133b5ec589b80f4a533af870370313580544c 0.7
-
Account Deleted (original author: huwei) Replying to zzzeek:
this change is trivial so it's back to 0.7:
470133b5ec589b80f4a533af870370313580544c 0.7
785e44c48be5a25a71b2f2d4fe5e5219ffcb93a8 0.8
382cd56772efd92a9fe5ce46623029a04163c8cf master Thanks for your quick response, I'll try your patch.
-
Account Deleted (original author: huwei) I have tried it, it does work. Thanks.
-
repo owner - removed milestone
Removing milestone: 0.7.xx (automated comment)
- Log in to comment
will have to see if we can just use urlparse() for that parsing. the workaround for now would be to instantiate a URL() object directly, though you'd have to bypass openstack's configuration system for that.