Bug 997290 - /usr/bin/openstack-db --init --service glance fails
Summary: /usr/bin/openstack-db --init --service glance fails
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat OpenStack
Classification: Red Hat
Component: python-oslo-config
Version: 3.0
Hardware: Unspecified
OS: Linux
urgent
low
Target Milestone: beta
: 4.0
Assignee: Alan Pevec
QA Contact: Yogev Rabl
URL:
Whiteboard: storage
Depends On:
Blocks: 1000447
TreeView+ depends on / blocked
 
Reported: 2013-08-15 06:49 UTC by Gilles Dubreuil
Modified: 2016-04-27 01:08 UTC (History)
13 users (show)

Fixed In Version: python-oslo-config-1.2.0-0.3.a3.el6ost
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1000447 (view as bug list)
Environment:
Last Closed: 2013-12-20 00:19:27 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2013:1859 0 normal SHIPPED_LIVE Red Hat Enterprise Linux OpenStack Platform Enhancement Advisory 2013-12-21 00:01:48 UTC

Description Gilles Dubreuil 2013-08-15 06:49:49 UTC
Description of problem:
Setup glance using "openstack-db --init" command fails

Version-Release number of selected component (if applicable):
RHOS3.0 on RHEL4.x - openstack-glance-2013.1.3-1.el6ost.noarch.rpm

The following .ini files are missing:
/etc/glance/glance-api-paste.ini
/etc/glance/glance-registry-paste.ini

The default /etc/glance/glance-registry.conf is not working

How reproducible:

Steps to Reproduce:
1. yum install -y mysql mysql-server openstack-glance
2. /usr/bin/openstack-db --init --service glance -p glance -r ""

Actual results:
---------
# /usr/bin/openstack-db --init --service glance -p glance -r ""
Verified connectivity to MySQL.
Creating 'glance' database.
Initializing the glance database, please wait...
2013-08-15 06:13:05.796 12957 CRITICAL glance [-] (OperationalError) unable to open database file None None
ERROR 1146 (42S02) at line 1: Table 'glance.migrate_version' doesn't exist
Final sanity check failed.
Please file a bug report on bugzilla.redhat.com against the openstack-glance package.
---------

Expected results:
---------
# /usr/bin/openstack-db --init --service glance -p glance -r ""
Verified connectivity to MySQL.
Creating 'glance' database.
Initializing the glance database, please wait...
Complete!
---------

Additional info:
BZ# 912143 seems to be same problem minus the .ini files (?)

Work around:

1. Add 2 missing ini files

$ cat > /etc/glance/glance-registry-paste.ini <<EOF
# Use this pipeline for no auth - DEFAULT
[pipeline:glance-registry]
pipeline = unauthenticated-context registryapp

# Use this pipeline for keystone auth
[pipeline:glance-registry-keystone]
pipeline = authtoken context registryapp

[app:registryapp]
paste.app_factory = glance.registry.api.v1:API.factory

[filter:context]
paste.filter_factory = glance.api.middleware.context:ContextMiddleware.factory

[filter:unauthenticated-context]
paste.filter_factory = glance.api.middleware.context:UnauthenticatedContextMiddleware.factory

[filter:authtoken]
paste.filter_factory = keystoneclient.middleware.auth_token:filter_factory
EOF

$ cat > /etc/glance/glance-api-paste.ini <<EOF
# Use this pipeline for no auth or image caching - DEFAULT
[pipeline:glance-api]
pipeline = versionnegotiation unauthenticated-context rootapp

# Use this pipeline for image caching and no auth
[pipeline:glance-api-caching]
pipeline = versionnegotiation unauthenticated-context cache rootapp

# Use this pipeline for caching w/ management interface but no auth
[pipeline:glance-api-cachemanagement]
pipeline = versionnegotiation unauthenticated-context cache cachemanage rootapp

# Use this pipeline for keystone auth
[pipeline:glance-api-keystone]
pipeline = versionnegotiation authtoken context rootapp

# Use this pipeline for keystone auth with image caching
[pipeline:glance-api-keystone+caching]
pipeline = versionnegotiation authtoken context cache rootapp

# Use this pipeline for keystone auth with caching and cache management
[pipeline:glance-api-keystone+cachemanagement]
pipeline = versionnegotiation authtoken context cache cachemanage rootapp

[composite:rootapp]
paste.composite_factory = glance.api:root_app_factory
/: apiversions
/v1: apiv1app
/v2: apiv2app

[app:apiversions]
paste.app_factory = glance.api.versions:create_resource

[app:apiv1app]
paste.app_factory = glance.api.v1.router:API.factory

[app:apiv2app]
paste.app_factory = glance.api.v2.router:API.factory

[filter:versionnegotiation]
paste.filter_factory = glance.api.middleware.version_negotiation:VersionNegotiationFilter.factory

[filter:cache]
paste.filter_factory = glance.api.middleware.cache:CacheFilter.factory

[filter:cachemanage]
paste.filter_factory = glance.api.middleware.cache_manage:CacheManageFilter.factory

[filter:context]
paste.filter_factory = glance.api.middleware.context:ContextMiddleware.factory

[filter:unauthenticated-context]
paste.filter_factory = glance.api.middleware.context:UnauthenticatedContextMiddleware.factory

[filter:authtoken]
paste.filter_factory = keystoneclient.middleware.auth_token:filter_factory
delay_auth_decision = true
EOF

$ chmod 640 /etc/glance/glance-registry-paste.ini /etc/glance/glance-api-paste.ini
$ chown root.glance /etc/glance/glance-registry-paste.ini /etc/glance/glance-api-paste.ini

2. Copy provided (or create your own) /etc/glance/glance-registry.conf file:
$ cp /usr/share/glance/glance-registry-dist.conf /etc/glance/glance-registry.conf

3. Run (or re-run) openstack-db (drop the database glance if needed)

$  /usr/bin/openstack-db --init --service glance -p glance -r ""
Verified connectivity to MySQL.
Database 'glance' already exists. Please consider first running:
/usr/bin/openstack-db --drop --service glance

$ /usr/bin/openstack-db --drop --service glance
Please enter the password for the 'root' MySQL user: 
Verified connectivity to MySQL.
Dropping 'glance' database.
Complete!

$ /usr/bin/openstack-db --init --service glance -p glance -r ""
Verified connectivity to MySQL.
Creating 'glance' database.
Initializing the glance database, please wait...
Complete!

Comment 1 Gilles Dubreuil 2013-08-15 10:26:33 UTC
For the above work around step 1:

The .ini files are actually available in the rpm and can be copied directly from /usr/share/glance/:

$ cp /usr/share/glance/glance-registry-dist-paste.ini  /etc/glance/glance-registry-paste.ini

$ cp /usr/share/glance/glance-api-dist-paste.ini  /etc/glance/glance-api-paste.ini

$ chmod 640 /etc/glance/glance-registry-paste.ini /etc/glance/glance-api-paste.ini

$ chown root.glance /etc/glance/glance-registry-paste.ini /etc/glance/glance-api-paste.ini

Comment 3 Alan Pevec 2013-08-19 17:59:47 UTC
Something is not right, you shouldn't copy paste.inis, in /usr/share/glance/glance-api-dist.conf there is:
[paste_deploy]
config_file = /usr/share/glance/glance-api-dist-paste.ini

Comment 4 Gilles Dubreuil 2013-08-20 07:01:48 UTC
I agree, something's not right.

I bumped into this because of an automated deployement process that works on RDO but fails on RHOS and expecting the .ini files to be in the /etc/glance dir.

After looking further into it.

The two glance-{api,registry}.conf are expecting the ini files to be in the /etc/glance directory by default

When comparing: 
openstack-glance-2013.1.2-2.el6.noarch.rpm (RDO)
vs
openstack-glance-2013.1.3-1.el6ost.noarch (RHOS)

once can see the RPM scriptlets are exactly the same, 
but the ini files are by default in /etc/glance for RDO and in /usr/share/glance for RHOS.

I believe the RHOS RPM to be repackaged witht the ini files in the /etc/glance.

Comment 5 Alan Pevec 2013-08-20 11:01:23 UTC
> I believe the RHOS RPM to be repackaged witht the ini files in the
> /etc/glance.

paste.ini should stay in /usr/share/glance, python-oslo-config in RHOS is patched to look into that location, are we sure there isn't RDO/RHOS RPM mixup here?

Comment 6 Gilles Dubreuil 2013-08-20 12:54:01 UTC
> paste.ini should stay in /usr/share/glance, python-oslo-config in RHOS is 
> patched to look into that location, are we sure there isn't RDO/RHOS RPM mixup > here?

Well, I suppose it's RDO which is mixed-up. I initially based my configuration from it :(

In that case any chance for /usr/share/glance/*.conf files to be installed as the default in /etc/glance/? Instead of having dummy ones by default?

Comment 7 Alan Pevec 2013-08-20 15:58:17 UTC
/usr/share/PROJECT/*-dist.conf include distribution defaults, /etc/PROJECT/*.conf are where site customization goes, overriding distro defaults.
In RPM, /etc/PROJECT/*.conf includes commented out distro default values and parameter documentation. See bug 887334 comment 4 for the background.

We're in the process of switching RDO Havana packages to this setup, to decrease RDO/RHOS delta.

Comment 8 Alan Pevec 2013-08-20 16:18:58 UTC
All that said, glance-manage is not picking out values from /usr/share/glance/ hence openstack-db --init ends up creating glance.sqlite instead of mysql db as specified in dist.conf.

Confirmed with openstack-glance-2013.1.2-1.el6ost from RHN, so it's not a regression in the current 3.0.z update, but from earlier: patch python-oslo-config bug 958497 doesn't work for glance where are two conf files, not just $project-dist.conf

Comment 21 Dafna Ron 2013-10-03 09:06:17 UTC
I installed glance manually and than ran packstack with Havana release. 
files were deployed correctly and db was installed. 

openstack-glance-2013.2-0.10.b3.el6ost.noarch

moving to verified

Comment 24 errata-xmlrpc 2013-12-20 00:19:27 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-2013-1859.html


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