Bug 1094675

Summary: glance-manage db_sync silently fails to prepare the database
Product: Red Hat OpenStack Reporter: Flavio Percoco <fpercoco>
Component: openstack-glanceAssignee: Flavio Percoco <fpercoco>
Status: CLOSED ERRATA QA Contact: Tzach Shefi <tshefi>
Severity: unspecified Docs Contact:
Priority: medium    
Version: 5.0 (RHEL 7)CC: adahms, brad, eglynn, fdinitto, fpercoco, fsimonce, nlevinki, sclewis, scohen, yeylon
Target Milestone: rc   
Target Release: 5.0 (RHEL 7)   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: openstack-glance-2014.1-4.el7ost Doc Type: Bug Fix
Doc Text:
Previously, attempting to perform the 'glance-manage db_sync' operation would fail without reporting any errors under certain conditions. This was caused by a requirement in the Icehouse release and above specifying that all tables in the database use the UTF-8 character set when certain Glance-related tables from previous releases used character sets other than UTF-8. This update adds the line 'db_enforce_mysql_charset = False' to the 'glance-api-dist.conf' file, disabling checking of the character set and making it possible for the 'glance-manage db_sync' operation to complete successfully under these conditions.
Story Points: ---
Clone Of: 1090648 Environment:
Last Closed: 2014-07-08 15:32:23 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Flavio Percoco 2014-05-06 09:46:11 UTC
+++ This bug was initially created as a clone of Bug #1090648 +++

Description of problem:
glance-manage db_sync silently fails to prepare the database:

# glance-manage db_sync && echo ok
ok

# mysql glance -e "show tables"
+------------------+
| Tables_in_glance |
+------------------+
| migrate_version  |
+------------------+

Version-Release number of selected component (if applicable):
openstack-glance-2014.1-1.el6.noarch

How reproducible:
100%

Steps to Reproduce:
1. connection = mysql://glance:glance@localhost/glance
2. openstack-db --init --service glance

Actual results:
# openstack-db --init --service glance && echo ok
Verified connectivity to MySQL.
Creating 'glance' database.
Initializing the glance database, please wait...
Complete!
ok

# mysql glance -e "show tables"
+------------------+
| Tables_in_glance |
+------------------+
| migrate_version  |
+------------------+

Expected results:
The glance database should be ready to be used or an error should be clearly reported.

Additional info:
Adding some debugging it's possible to see that the actual error is:

# glance-manage db_sync && echo ok
Tables "migrate_version" have non utf8 collation, please make sure all tables are CHARSET=utf8
ok

If CHARSET=utf8 is another issue that should be fixed separately (and not just something related to my env) feel free to split the bug.

--- Additional comment from Brad P. Crochet on 2014-05-05 10:59:58 EDT ---

As a workaround, one can set:

db_enforce_mysql_charset=False

in /etc/glance/glance.conf

This will get you past this error.

--- Additional comment from Brad P. Crochet on 2014-05-05 11:00:21 EDT ---

Sorry... /etc/glance/glance-api.conf

--- Additional comment from Federico Simoncelli on 2014-05-05 11:55:42 EDT ---

(In reply to Brad P. Crochet from comment #1)
> As a workaround, one can set:
> 
> db_enforce_mysql_charset=False
> 
> in /etc/glance/glance.conf
> 
> This will get you past this error.

The biggest problem is that the error is not printed anywhere (I had to manually add debugging to the code) so no one can tell if this is the issue they're having.

--- Additional comment from Flavio Percoco on 2014-05-06 05:44:23 EDT ---

I agree a proper error is necessary.

Comment 5 Fabio Massimo Di Nitto 2014-06-06 08:23:35 UTC
I can still hit this problem with those builds:

[root@rhos5-glance1 ~]# rpm -q -a |grep glance
python-glance-2014.1-2.el7ost.noarch
python-glanceclient-0.12.0-1.el7ost.noarch
openstack-glance-2014.1-2.el7ost.noarch

and I had to manually force db_enforce_mysql_charset.

Comment 7 Tzach Shefi 2014-06-12 12:05:20 UTC
Verified on:
RHEL6.5    (used el6, el7 packages are the same)
python-glanceclient-0.12.0-1.el6.noarch
python-glance-2014.1-4.el6ost.noarch
openstack-glance-2014.1-4.el6ost.noarch

Test flow
1. Manually installed: mysql keystone Glance (Havana 2013.2.3-2.el6) over RHEL6.5.
2. Configured and checked Glance service, checked Glance db.
3. Stopped Glance services
4. Downloaded Glance Icehouse build packages 2014.1-4.el6ost.
3. Upgraded Glance to new packages. 
4. Ran #glance-manage db_sync && echo ok 
Glance-manage db_sync works fine,  OK echo not returned not sure why.  
6. Checked Glance db fits Icehouse release, checked a few basic Glance commands
7. glance-api.dist.conf file includes: db_enforce_mysql_charset = False
 

Flavio, thanks assistance.

Comment 10 errata-xmlrpc 2014-07-08 15:32:23 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHEA-2014-0851.html

Comment 11 Andrew Dahms 2017-08-28 22:59:18 UTC
Cancelling old needinfo request.