Bug 888773 - Quantum installation failed to connect to MySQL
Summary: Quantum installation failed to connect to MySQL
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat OpenStack
Classification: Red Hat
Component: doc-Getting_Started_Guide
Version: 2.0 (Folsom)
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: ---
: 2.1
Assignee: Stephen Gordon
QA Contact: ecs-bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-12-19 13:10 UTC by Martin Magr
Modified: 2016-04-26 18:11 UTC (History)
4 users (show)

Fixed In Version: Red_Hat_OpenStack-Getting_Started_Guide-2-web-en-US-1.0-27.el6eng
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-04-11 06:58:36 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Martin Magr 2012-12-19 13:10:13 UTC
Description of problem:
After going through installation steps for Quantum [1] I see MySQL connection error in /var/log/quantum/server.log:

[para@virtual-rhel-beta ~(keystone_test)]$ tail -f /var/log/quantum/server.log 
2012-12-19 13:55:53     INFO [quantum.db.api] Database registration exception: (OperationalError) (2005, "Unknown MySQL server host 'virtual-rhel-beta' (1)") None None
2012-12-19 13:55:53     INFO [quantum.db.api] Unable to connect to database, infinite attempts left. Retrying in 2 seconds
2012-12-19 13:55:55     INFO [quantum.db.api] Database registration exception: (OperationalError) (2005, "Unknown MySQL server host 'virtual-rhel-beta' (1)") None None

I've inserted 127.0.0.1 as host to all questions during installation and yet hostname is used. I had to fix it manually in /etc/quantum/plugin.ini

[1] - https://access.redhat.com/knowledge/docs/en-US/Red_Hat_OpenStack_Preview/2/html/Getting_Started_Guide/chapter-Quantum.html

Version-Release number of selected component (if applicable):
[para@virtual-rhel-beta ~(keystone_test)]$ rpm -qa *quantum*
openstack-quantum-2012.2.1-1.el6ost.noarch
openstack-quantum-openvswitch-2012.2.1-1.el6ost.noarch
python-quantum-2012.2.1-1.el6ost.noarch
python-quantumclient-2.1.10-1.el6ost.noarch

Expected results:
Mention this problem in the guide or fix quantum installation to use IP address by default.

Comment 2 Gary Kotton 2012-12-23 11:31:18 UTC
Hi,
Is virtual-rhel-beta in your /etc/hosts file?
Ar you able to ping virtual-rhel-beta?
Thanks
Gary

Comment 3 Ofer Blaut 2012-12-23 13:24:52 UTC
From some reason host name is auto added into /etc/quantum/plugin.ini

this is the problem

Comment 4 Gary Kotton 2013-01-06 07:39:44 UTC
Hi,
The host name is added when the configuration for the mysql server is created. This is done on purpose. Can you please clarify why the hosts file is not updated. This is the problem.
Maybe this need to be noted as a documentation issue.
Thanks
Gary

Comment 5 Martin Magr 2013-01-11 13:34:09 UTC
I've done installation on plain machine and forgot to update /etc/hosts with hostname. If hostname is required in config even though IP address is entered during installation, then it should be probably documented to set hostname resolving at first.

Comment 6 Gary Kotton 2013-01-13 14:12:48 UTC
I have moved this to a documentation bug.

In short the host file needs to contain the hostname.

Comment 7 Stephen Gordon 2013-01-29 20:49:08 UTC
Gary, what is the exact reason that Quantum's MySQL configuration *requires* a host name? If packstack starts doing Quantum deployment will it handle this step (and is this requirement tracked anywhere)?

As far as I can work out the other components are able to interact with MySQL using just the IP (my setups don't have entries in /etc/hosts at the moment).

Comment 8 Gary Kotton 2013-02-13 17:15:51 UTC
Hi,
At the moment Quantum makes use of a number of "utility" scripts, for example the quantum-server-setup. This is essentially what packstack does behind the scenes. The script that we use takes the host name and uses that as part of the mysql connection:
for example:
sql_connection = mysql://quantum:quantum.redhat.com/ovs_quantum
This hostname should resolve to a IP address. The problem with the original bug was that the hostname did not resolve to an IP address and hence everything failed.
Thanks
Gary

Comment 9 Stephen Gordon 2013-02-13 18:52:58 UTC
(In reply to comment #8)
> Hi,
> At the moment Quantum makes use of a number of "utility" scripts, for
> example the quantum-server-setup. This is essentially what packstack does
> behind the scenes. The script that we use takes the host name and uses that
> as part of the mysql connection:

I guess what I am really asking is why we aren't fixing these Quantum specific scripts to be consistent with the other components instead of making an exception in the documentation? 

When I use packstack for other components without a hostname it handles it just fine and uses the IP. Here is an example from a nova.conf file created by packstack:

sql_connection=mysql://nova:70944079c01542c7.24.136/nova

Comment 10 Stephen Gordon 2013-02-21 21:09:43 UTC
E-mailed Gary Kotton and Chris Wright about this issue today.

Comment 11 Stephen Gordon 2013-02-27 19:33:10 UTC
Discussed further with Gary and Chris via email and there doesn't seem to be any desire to change this behaviour at this time.

Comment 12 Stephen Gordon 2013-03-11 19:45:43 UTC
commit ba6756a5192cf203e0f56548fcf29bc7531220c5
Author: Stephen Gordon <sgordon>
Date:   Mon Mar 11 15:42:26 2013 -0400

    BZ#888773 - Add entry to /etc/hosts before quantum-server-setup.
    
    Added step to add an entry for the local host to /etc/hosts
    before running quantum-server-setup. This is a requirement
    because Quantum will use the IP address to access the database
    that it installs.
    
    Also corrected spelling of multiple in introductory material
    for Quantum chapter.
    
    Change-Id: Ib39af528abd7c7d1cd7e8e84fc82eeb05e78adef


Note You need to log in before you can comment on or make changes to this bug.