maintainer scripts always/inconsistently run db_sync during upgrade

Bug #1290423 reported by James Page
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cinder (Ubuntu)
Fix Released
High
James Page
Trusty
Fix Released
High
James Page
glance (Ubuntu)
Fix Released
High
James Page
Trusty
Fix Released
High
James Page
keystone (Ubuntu)
Fix Released
High
Corey Bryant
Trusty
Fix Released
High
Corey Bryant
nova (Ubuntu)
Fix Released
High
James Page
Trusty
Fix Released
High
James Page

Bug Description

The keystone maintainer script endeavours to check whether the sql_connection string is set in keystone.conf; however it searches for the wrong string:

        if ! grep -q sql_connection /etc/keystone/keystone.conf
        then
            su -s /bin/sh -c 'exec keystone-manage db_sync' keystone
        fi

The connection configuration uses the key 'connection' and inline with other packages, I think we should only be doing a db_sync if the connection is the default sqllite one (see glance for reference).

This is quite important - 2013.2.2 adds an index to an existing table and takes a long time, resulting in quite a long outage; also running from multiple locations might be bad as well.

Related branches

James Page (james-page)
Changed in keystone (Ubuntu Trusty):
status: New → Triaged
importance: Undecided → High
Revision history for this message
Corey Bryant (corey.bryant) wrote :

James, cinder also doesn't have logic to only issue db_sync if the connection is the default sqllite one. Should I check all OpenStack services to make sure they're using the right search key and are only issuing db_sync if the connection is the default sqllite one?

Changed in keystone (Ubuntu Trusty):
assignee: nobody → Corey Bryant (corey.bryant)
Revision history for this message
James Page (james-page) wrote :

I think we should have a common approach; please can you raise bug tasks for all impacted openstack packages ('Also affects distribution').

James Page (james-page)
Changed in keystone (Ubuntu Trusty):
status: Triaged → In Progress
Revision history for this message
James Page (james-page) wrote :

Corey

Thanks for the merge proposal; I reworked it a bit as we don't want to drop the sql connection patch - and after a little thought and testing I think that checking for:

  grep -q "^connection.*sqlite.*" /etc/keystone/keystone.conf

is quicker and more effective than what you proposed; this ensures that if someone comments out the default connection url provided in the packaging its not detected by mistake.

We should apply this consistently across the packages - raising tasks for cinder, nova and glance as well - neutron might not need this.

James Page (james-page)
Changed in cinder (Ubuntu Trusty):
assignee: nobody → James Page (james-page)
status: New → In Progress
importance: Undecided → High
summary: - maintainer scripts always run db_sync during upgrade
+ maintainer scripts always/inconsistently run db_sync during upgrade
Revision history for this message
James Page (james-page) wrote :

Actually we probably need to deal with deprecated config as well:

"^(sql_)?connection.*sqlite.*"

James Page (james-page)
Changed in glance (Ubuntu Trusty):
status: New → In Progress
assignee: nobody → James Page (james-page)
Changed in keystone (Ubuntu Trusty):
status: In Progress → Fix Committed
James Page (james-page)
Changed in glance (Ubuntu Trusty):
status: In Progress → Fix Committed
Changed in cinder (Ubuntu Trusty):
status: In Progress → Fix Committed
Changed in nova (Ubuntu Trusty):
importance: Undecided → High
Changed in glance (Ubuntu Trusty):
importance: Undecided → High
Changed in nova (Ubuntu Trusty):
status: New → In Progress
assignee: nobody → James Page (james-page)
James Page (james-page)
Changed in nova (Ubuntu Trusty):
status: In Progress → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package cinder - 1:2014.1~b3-0ubuntu2

---------------
cinder (1:2014.1~b3-0ubuntu2) trusty; urgency=medium

  * d/cinder-common.postinst: Correct use of getent (LP: #1224275).
  * d/cinder-common.postinst: Tidy detection of local sqlite database use
    for db sync operations (LP: #1290423).
 -- James Page <email address hidden> Thu, 13 Mar 2014 10:11:20 +0000

Changed in cinder (Ubuntu Trusty):
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package nova - 1:2014.1~b3-0ubuntu2

---------------
nova (1:2014.1~b3-0ubuntu2) trusty; urgency=medium

  * d/nova-common.postinst: Tidy detection of default sqlite to ensure
    that db sync is only run against local databases (LP: #1290423).
 -- James Page <email address hidden> Thu, 13 Mar 2014 11:00:23 +0000

Changed in nova (Ubuntu Trusty):
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package glance - 1:2014.1~b3-0ubuntu2

---------------
glance (1:2014.1~b3-0ubuntu2) trusty; urgency=medium

  * d/glance-registry.postinst: Tidy detection of the default sqlite
    connection when running db_sync (LP: #1290423).
 -- James Page <email address hidden> Thu, 13 Mar 2014 10:38:35 +0000

Changed in glance (Ubuntu Trusty):
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package keystone - 1:2014.1~b3-0ubuntu3

---------------
keystone (1:2014.1~b3-0ubuntu3) trusty; urgency=medium

  * d/p/revoke-api.patch: Add upstream patch to resolve critical issue with
    token revocation (LP: #1289935).
  * d/keystone.postinst: Ensure db_sync is only run when the default sqlite
    connection is configured (LP: #1290423).
 -- Corey Bryant <email address hidden> Wed, 12 Mar 2014 23:20:05 -0500

Changed in keystone (Ubuntu Trusty):
status: Fix Committed → Fix Released
Revision history for this message
Corey Bryant (corey.bryant) wrote : Re: [Bug 1290423] Re: maintainer scripts always run db_sync during upgrade

On Wed, Mar 12, 2014 at 11:15 AM, James Page <email address hidden> wrote:

> I think we should have a common approach; please can you raise bug tasks
> for all impacted openstack packages ('Also affects distribution').
>

What do you mean by 'Also affects distribution'?

--
Regards,
Corey

Revision history for this message
Soren Hansen (soren) wrote :

"Also affects distribition" is that little link below the bug task table at the top of bug details pages. It's how you add bug tasks for other packages.

Revision history for this message
Corey Bryant (corey.bryant) wrote : Re: [Bug 1290423] Re: maintainer scripts always/inconsistently run db_sync during upgrade

Ah.. yes, thanks!

On Thu, Mar 13, 2014 at 10:32 PM, Soren Hansen <email address hidden> wrote:

> "Also affects distribition" is that little link below the bug task table
> at the top of bug details pages. It's how you add bug tasks for other
> packages.
>
> --
> You received this bug notification because you are a bug assignee.
> https://bugs.launchpad.net/bugs/1290423
>
> Title:
> maintainer scripts always/inconsistently run db_sync during upgrade
>
> Status in "cinder" package in Ubuntu:
> Fix Released
> Status in "glance" package in Ubuntu:
> Fix Released
> Status in "keystone" package in Ubuntu:
> Fix Released
> Status in "nova" package in Ubuntu:
> Fix Released
> Status in "cinder" source package in Trusty:
> Fix Released
> Status in "glance" source package in Trusty:
> Fix Released
> Status in "keystone" source package in Trusty:
> Fix Released
> Status in "nova" source package in Trusty:
> Fix Released
>
> Bug description:
> The keystone maintainer script endeavours to check whether the
> sql_connection string is set in keystone.conf; however it searches for
> the wrong string:
>
> if ! grep -q sql_connection /etc/keystone/keystone.conf
> then
> su -s /bin/sh -c 'exec keystone-manage db_sync' keystone
> fi
>
> The connection configuration uses the key 'connection' and inline with
> other packages, I think we should only be doing a db_sync if the
> connection is the default sqllite one (see glance for reference).
>
> This is quite important - 2013.2.2 adds an index to an existing table
> and takes a long time, resulting in quite a long outage; also running
> from multiple locations might be bad as well.
>
> To manage notifications about this bug go to:
>
> https://bugs.launchpad.net/ubuntu/+source/cinder/+bug/1290423/+subscriptions
>

--
Regards,
Corey

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.