Bug 888773

Summary: Quantum installation failed to connect to MySQL
Product: Red Hat OpenStack Reporter: Martin Magr <mmagr>
Component: doc-Getting_Started_GuideAssignee: Stephen Gordon <sgordon>
Status: CLOSED CURRENTRELEASE QA Contact: ecs-bugs
Severity: low Docs Contact:
Priority: low    
Version: 2.0 (Folsom)CC: breeler, gkotton, sgordon, ykaul
Target Milestone: ---Keywords: Documentation, Triaged
Target Release: 2.1   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Red_Hat_OpenStack-Getting_Started_Guide-2-web-en-US-1.0-27.el6eng Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-04-11 02:58:36 EDT Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description Martin Magr 2012-12-19 08:10:13 EST
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 06:31:18 EST
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 08:24:52 EST
From some reason host name is auto added into /etc/quantum/plugin.ini

this is the problem
Comment 4 Gary Kotton 2013-01-06 02:39:44 EST
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 08:34:09 EST
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 09:12:48 EST
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 15:49:08 EST
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 12:15:51 EST
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@dhcp-4-83.tlv.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 13:52:58 EST
(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@10.15.24.136/nova
Comment 10 Stephen Gordon 2013-02-21 16:09:43 EST
E-mailed Gary Kotton and Chris Wright about this issue today.
Comment 11 Stephen Gordon 2013-02-27 14:33:10 EST
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 15:45:43 EDT
commit ba6756a5192cf203e0f56548fcf29bc7531220c5
Author: Stephen Gordon <sgordon@redhat.com>
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