mysql driver gives ToozConnectionError error

Bug #1426351 reported by Abhijeet Malawade
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tooz
Fix Released
Medium
Abhijeet Malawade

Bug Description

When I try to use tooz 'mysql' driver for distributed locking, it gives below errors:

1. It gives 'ImportError':

>>> coordinator = coordination.get_coordinator('mysql://root:admin@127.0.0.1/test', 'test')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "tooz/coordination.py", line 357, in get_coordinator
    invoke_args=(member_id, parsed_url, parsed_qs)).driver
  File "/usr/local/lib/python2.7/dist-packages/stevedore/driver.py", line 45, in __init__
    verify_requirements=verify_requirements,
  File "/usr/local/lib/python2.7/dist-packages/stevedore/named.py", line 55, in __init__
    verify_requirements)
  File "/usr/local/lib/python2.7/dist-packages/stevedore/extension.py", line 170, in _load_plugins
    self._on_load_failure_callback(self, ep, err)
  File "/usr/local/lib/python2.7/dist-packages/stevedore/driver.py", line 50, in _default_on_load_failure
    raise err
ImportError: No module named pymysql
>>>

It is giving this error because 'pymysql' is not added in 'requirements.txt' file (it is present in test-requirements.txt)

2. after manually installing 'pymysql' I am getting below error:

>>> from tooz import coordination
>>>
>>> coordinator = coordination.get_coordinator('mysql://root:admin@127.0.0.1/test', 'test')
>>> coordinator.start()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "tooz/coordination.py", line 182, in start
    self._start()
  File "tooz/drivers/mysql.py", line 95, in _start
    raise coordination.ToozConnectionError(utils.exception_message(e))
tooz.coordination.ToozConnectionError: (2003, "Can't connect to MySQL server on 'root:admin@127.0.0.1' ([Errno -2] Name or service not known)")
>>>

tooz is not parsing mysql connection string properly.

Here tooz is using oslo_utils for parsing connection string (https://github.com/openstack/tooz/blob/master/tooz/coordination.py#L351)
and using parsed_url.netloc (https://github.com/openstack/tooz/blob/master/tooz/drivers/mysql.py#L73) in mysql driver.
Insted of 'parsed_url.netloc' need to use 'parsed_url.hostname' for getting host name.

Changed in python-tooz:
assignee: nobody → Abhijeet Malawade (abhijeet-malawade)
Changed in python-tooz:
status: New → In Progress
Julien Danjou (jdanjou)
Changed in python-tooz:
status: In Progress → Invalid
status: Invalid → Triaged
importance: Undecided → Medium
Changed in python-tooz:
status: Triaged → In Progress
Revision history for this message
Abhijeet Malawade (abhijeet-malawade) wrote :
description: updated
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tooz (master)

Reviewed: https://review.openstack.org/159835
Committed: https://git.openstack.org/cgit/openstack/tooz/commit/?id=6ea2302ccf702ffc447020139111e5f9a2629314
Submitter: Jenkins
Branch: master

commit 6ea2302ccf702ffc447020139111e5f9a2629314
Author: Abhijeet Malawade <email address hidden>
Date: Fri Feb 27 05:26:01 2015 -0800

    fix mysql driver url parsing

    Used 'parsed_url.hostname' instead of 'parsed_url.netloc' to get hostname.

    Changed setup-mysql-env.sh script to start 'mysqld' with networking.

    Closes-Bug: 1426351
    Change-Id: Ifcf68b10ef5f93864d33d3a1719b9be321db6e5c

Changed in python-tooz:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tooz (stable/kilo)

Fix proposed to branch: stable/kilo
Review: https://review.openstack.org/167597

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tooz (stable/kilo)

Reviewed: https://review.openstack.org/167597
Committed: https://git.openstack.org/cgit/openstack/tooz/commit/?id=889f86cc15fab48d1f6a82bbb868de44d4f03afa
Submitter: Jenkins
Branch: stable/kilo

commit 889f86cc15fab48d1f6a82bbb868de44d4f03afa
Author: Abhijeet Malawade <email address hidden>
Date: Fri Feb 27 05:26:01 2015 -0800

    fix mysql driver url parsing

    Used 'parsed_url.hostname' instead of 'parsed_url.netloc' to get hostname.

    Changed setup-mysql-env.sh script to start 'mysqld' with networking.

    Closes-Bug: 1426351
    Change-Id: Ifcf68b10ef5f93864d33d3a1719b9be321db6e5c
    (cherry picked from commit 6ea2302ccf702ffc447020139111e5f9a2629314)

tags: added: in-stable-kilo
Changed in python-tooz:
milestone: none → 0.13.2
status: Fix Committed → 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.