Skip to content

Commit

Permalink
read_deleted snapshot and volume id mappings.
Browse files Browse the repository at this point in the history
Since the migration that creates the volume_id_mappings and
snapshot_id_mappings tables does not populate the 'deleted' column,
queries to this table should not limit results to 'deleted=0'.
Limiting to non-deleted rows results in duplicate mappings being
created for existing instance mappings after an upgrade, and
throws off volume and snapshot ID to UUID mapping.

This is a stop-gap measure to ensure avoid serious breakage during
an upgrade.  The NULL columns in this table are actually unused
currently and can be populated in later grizzly migrations, if they
end up being used.

Fixes bug 1065785.

Change-Id: I893c994362a203288b9984f0ede24cbb274bfcc5
(cherry picked from commit 43bf834)
  • Loading branch information
Adam Gandelman committed Oct 12, 2012
1 parent eee4dbb commit 32d8722
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions nova/db/sqlalchemy/api.py
Expand Up @@ -2994,12 +2994,14 @@ def _volume_get_query(context, session=None, project_only=False):

@require_context
def _ec2_volume_get_query(context, session=None):
return model_query(context, models.VolumeIdMapping, session=session)
return model_query(context, models.VolumeIdMapping,
session=session, read_deleted='yes')


@require_context
def _ec2_snapshot_get_query(context, session=None):
return model_query(context, models.SnapshotIdMapping, session=session)
return model_query(context, models.SnapshotIdMapping,
session=session, read_deleted='yes')


@require_context
Expand Down

0 comments on commit 32d8722

Please sign in to comment.