New database is not under version_controll

Bug #981111 reported by Justin Shepherd
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
glance (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

Description: Ubuntu precise (development branch)
Release: 12.04

Package: python-glance-2012.1-0ubuntu2

Set the following in /etc/glance/glance-registry.conf
sql_connection = mysql://root:password@127.0.0.1/glance

Issue: New database is not put under version control

# dpkg -l | grep glance
ii glance 2012.1-0ubuntu2 OpenStack Image Registry and Delivery Service - Daemons
ii glance-api 2012.1-0ubuntu2 OpenStack Image Registry and Delivery Service - API
ii glance-client 2012.1-0ubuntu2 OpenStack Image Registry and Delivery Service - Registry
ii glance-common 2012.1-0ubuntu2 OpenStack Image Registry and Delivery Service - Common
ii glance-registry 2012.1-0ubuntu2 OpenStack Image Registry and Delivery Service - Registry
ii python-glance 2012.1-0ubuntu2 OpenStack Image Registry and Delivery Service - Python library
# mysql -u root -ppassword -e "create database glance;"
# /etc/init.d/glance-registry restart
-- output snipped --
glance-registry stop/waiting
glance-registry start/running, process 6468
# glance-manage db_sync
ERROR: There was an error migrating the database.
Details: Database 'mysql://root:password@127.0.0.1/glance' does not appear to be under version control. Refusing to migrate. You can enable version control for by using 'glance-manage version_control [VERSION #]
# glance-manage db_version
ERROR: There was an error migrating the database.
Details: database 'mysql://root:password@127.0.0.1/glance' is not under migration control

-----

On 2012.1-0ubuntu1 packages, from:
http://launchpadlibrarian.net/100185482/glance_2012.1-0ubuntu1_all.deb
http://launchpadlibrarian.net/100185484/glance-common_2012.1-0ubuntu1_all.deb
http://launchpadlibrarian.net/100185485/glance-api_2012.1-0ubuntu1_all.deb
http://launchpadlibrarian.net/100185486/glance-registry_2012.1-0ubuntu1_all.deb
http://launchpadlibrarian.net/100185487/glance-client_2012.1-0ubuntu1_all.deb
http://launchpadlibrarian.net/100185481/python-glance_2012.1-0ubuntu1_all.deb

# dpkg -l | grep glance
ii glance 2012.1-0ubuntu1 OpenStack Image Registry and Delivery Service - Daemons
ii glance-api 2012.1-0ubuntu1 OpenStack Image Registry and Delivery Service - API
ii glance-client 2012.1-0ubuntu1 OpenStack Image Registry and Delivery Service - Registry
ii glance-common 2012.1-0ubuntu1 OpenStack Image Registry and Delivery Service - Common
ii glance-registry 2012.1-0ubuntu1 OpenStack Image Registry and Delivery Service - Registry
ii python-glance 2012.1-0ubuntu1 OpenStack Image Registry and Delivery Service - Python library
# mysql -u root -ppassword -e "create database glance;"
# /etc/init.d/glance-registry restart
-- output snipped --
glance-registry stop/waiting
glance-registry start/running, process 7287
# glance-manage db_sync
# glance-manage db_version
13

summary: - New database is not under version_controlled
+ New database is not under version_controll
Revision history for this message
Adam Gandelman (gandelman-a) wrote :

Justin-

Please see a bug filed against Glance earlier today: https://bugs.launchpad.net/bugs/981081 As it turns out, Essex glance does not actually run migrations against a new database anymore, it instead cheats (see description in that bug). The new Ubuntu package contains a patch that requires an extra step in creation of the glance database, we need to properly version control it and set it at version 0, to ensure all migrations are actually run:

glance-manage version_control 0
glance-manage db_sync

I should note that previously 2012.1-0ubuntu1, db_sync does not actually create the schema but glance-registry startup. If you were to stop glance-registry entirely, run db_sync, and inspect the glance database, the only thing that is created is a migrate_versions table wrongly claiming the db is versioned at version 13. Startup of glance-registry is actually creating the schema, albeit poorly, and migrate is not being used at all.

I've opted to refuse attempts to db_sync without first version_control, because ending up in the situation that db_sync is run without version_control results in 1, a database schema that only represents the current sqlalchemy models 2, greatly complicates incrementally downgrading or upgrading the database in the future.

This is a new issue and its possible we might work out a better solution that can be applied upstream and to our packages. In the meantime, run 'glance-manage version_control 0 && glance-manage db_sync' before migrating a new database (this is needed for using vanilla stable/essex branch as well)

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in glance (Ubuntu):
status: New → Confirmed
Revision history for this message
Adam Gandelman (gandelman-a) wrote :

Marking as Invalid as this is the expected and documented behavior of Glance on 12.04. Please reopen if necessary.

Changed in glance (Ubuntu):
status: Confirmed → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.