1
commit 43bf8344488a6af1046344c255bdb2edd7450475
2
Author: Adam Gandelman <adam.gandelman@canonical.com>
3
Date: Thu Oct 11 18:49:54 2012 -0700
5
read_deleted snapshot and volume id mappings.
7
Since the migration that creates the volume_id_mappings and
8
snapshot_id_mappings tables does not populate the 'deleted' column,
9
queries to this table should not limit results to 'deleted=0'.
10
Limiting to non-deleted rows results in duplicate mappings being
11
created for existing instance mappings after an upgrade, and
12
throws off volume and snapshot ID to UUID mapping.
14
This is a stop-gap measure to ensure avoid serious breakage during
15
an upgrade. The NULL columns in this table are actually unused
16
currently and can be populated in later grizzly migrations, if they
21
Change-Id: I893c994362a203288b9984f0ede24cbb274bfcc5
23
diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py
24
index dde41a6..0946d0b 100644
25
--- a/nova/db/sqlalchemy/api.py
26
+++ b/nova/db/sqlalchemy/api.py
27
@@ -2995,12 +2995,14 @@ def _volume_get_query(context, session=None, project_only=False):
30
def _ec2_volume_get_query(context, session=None):
31
- return model_query(context, models.VolumeIdMapping, session=session)
32
+ return model_query(context, models.VolumeIdMapping,
33
+ session=session, read_deleted='yes')
37
def _ec2_snapshot_get_query(context, session=None):
38
- return model_query(context, models.SnapshotIdMapping, session=session)
39
+ return model_query(context, models.SnapshotIdMapping,
40
+ session=session, read_deleted='yes')