Replace nova.db.sqlalchemy.utils with openstack.common.db.sqlalchemy.utils

Bug #1280055 reported by Matt Riedemann
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Low
Matt Riedemann
oslo-incubator
Fix Released
Low
Matt Riedemann

Bug Description

Most of the code in nova.db.sqlalchemy.utils is also in oslo-incubator.openstack.common.db.sqlalchemy.utils, except for the modify_indexes method which is not actually even used in the nova db migration code anymore now that it's been compacted in icehouse.

Also, the oslo.db code has been getting synced over to nova more frequently lately so rather than keep all of this duplicate code around we should move nova to using the oslo utils code and drop the internal nova one, with maybe moving the modify_indexes method to oslo first, then sync back to nova and then drop nova.db.sqlalchemy.utils from nova.

We will have to make sure that there are no behavior differences in the oslo code such that it would change the nova db schema, but we should be able to use Dan Prince's nova/tools/db/schema_diff.py script to validate that.

Tags: db
Matt Riedemann (mriedem)
Changed in nova:
assignee: nobody → Matt Riedemann (mriedem)
importance: Undecided → Low
status: New → Triaged
Revision history for this message
Matt Riedemann (mriedem) wrote :

Targeting this to Juno and might need to be a blueprint, not sure, I'll bring that up with Russell or in the nova meeting since it would be a series of patches probably.

Changed in nova:
milestone: none → next
Revision history for this message
John Garbutt (johngarbutt) wrote :

Seems very late for this kind of change.

Changed in nova:
milestone: next → none
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/79070

Changed in nova:
status: Triaged → In Progress
Matt Riedemann (mriedem)
Changed in oslo:
assignee: nobody → Matt Riedemann (mriedem)
importance: Undecided → Low
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to oslo-incubator (master)

Fix proposed to branch: master
Review: https://review.openstack.org/79086

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to oslo-incubator (master)

Reviewed: https://review.openstack.org/79086
Committed: https://git.openstack.org/cgit/openstack/oslo-incubator/commit/?id=41a329d0b04c23dbebeb476a3fd0f1ff86174560
Submitter: Jenkins
Branch: master

commit 41a329d0b04c23dbebeb476a3fd0f1ff86174560
Author: Matt Riedemann <email address hidden>
Date: Fri Mar 7 13:33:05 2014 -0800

    Move test_insert_from_select unit test from nova to oslo

    Nova had it's own copy of InsertFromSelect so change Iefa5b431 is
    removing that copy from Nova to use the version in Oslo. The only
    difference is Nova had an additional unit test for InsertFromSelect so
    we can move that to Oslo.

    Partial-Bug: #1280055

    Change-Id: I457acf335c4877c398c443b0cfde55bb997dfe6d

Revision history for this message
Matt Riedemann (mriedem) wrote :

This is dependent on fixing oslo bug 1307266.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to oslo-incubator (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/87369

Revision history for this message
Openstack Gerrit (openstack-gerrit) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/79070
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=1a8dd2487d95327b97ebf8e8b4a27420d1432fd4
Submitter: Jenkins
Branch: master

commit 1a8dd2487d95327b97ebf8e8b4a27420d1432fd4
Author: Matt Riedemann <email address hidden>
Date: Fri Mar 7 06:29:38 2014 -0800

    Remove duplicate code from nova.db.sqlalchemy.utils

    There is a lot of code in nova.db.sqlalchemy.utils which is also in
    oslo-incubator's openstack.common.db.sqlalchemy.utils module so this
    patch goes through and cleans up Nova.

    Notable differences:

    1. modify_indexes was nova-only but no longer used after the migration
       compaction work, so it's just removed here. It also didn't really
       work for mysql in cases where the index name was too long so it
       could be table-specific and therefore unusable in some mysql cases.
       See commit 029ebab for history.
    2. create_shadow_table was not in oslo-incubator and it's also not
       currently used in nova after the migration compaction, however,
       I leave it here in case future migrations in Nova need to use it.
       This patch does replace the usage of _get_not_supported_column in
       create_shadow_table to use the same method from oslo's DB utils.
    3. DeleteFromSelect is still used within nova.db.api per
       commit b36826e so we could move it to oslo-incubator but this
       patch leaves it for now since it's only used in Nova.
    4. InsertFromSelect was introduced with commit 2e403b2 but now there
       is a copy in oslo-incubator so we can remove our usage in nova.
       However, oslo doesn't have the unit test that nova does, so the
       unit test has been moved to oslo with change I457acf33.
    5. Oslo has is_backend_avail and get_connect_string methods so use
       those in test_migrations.py while doing this update.

    Closes-Bug: #1280055

    Change-Id: Iefa5b4311f1fe1a5da31cf527521c393f2face7c

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → juno-1
status: Fix Committed → Fix Released
Changed in oslo:
status: In Progress → Fix Committed
Changed in oslo:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: juno-1 → 2014.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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