Red Hat Bugzilla – Bug 888773
Quantum installation failed to connect to MySQL
Last modified: 2016-04-26 14:11:00 EDT
Description of problem:
After going through installation steps for Quantum  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
 - 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*
Mention this problem in the guide or fix quantum installation to use IP address by default.
Is virtual-rhel-beta in your /etc/hosts file?
Ar you able to ping virtual-rhel-beta?
From some reason host name is auto added into /etc/quantum/plugin.ini
this is the problem
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.
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.
I have moved this to a documentation bug.
In short the host file needs to contain the hostname.
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).
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:
sql_connection = mysql://quantum:email@example.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.
(In reply to comment #8)
> 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:
E-mailed Gary Kotton and Chris Wright about this issue today.
Discussed further with Gary and Chris via email and there doesn't seem to be any desire to change this behaviour at this time.
Author: Stephen Gordon <firstname.lastname@example.org>
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.