From e687098cf14e7e83e2c7c4252c895324e6735e24 Mon Sep 17 00:00:00 2001 From: Wen Cheng Ma Date: Mon, 3 Mar 2014 17:49:15 +0800 Subject: [PATCH] Fix glance db migration failed on 031 In fact, the first where expression has filtered the duplicated locations, and the second filters the locations which have more than 1 rows, so the second result set is included in the first. In DB2, if the boolean of where expression is true, it will throw error. So remove the second where expression to fix glance db migration failed on 031. Fixes bug #1287087 Change-Id: Id485b6d20696e989d10f3759011387137543918a --- .../migrate_repo/versions/031_remove_duplicated_locations.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/glance/db/sqlalchemy/migrate_repo/versions/031_remove_duplicated_locations.py b/glance/db/sqlalchemy/migrate_repo/versions/031_remove_duplicated_locations.py index 3559ae4d74..a468aeb787 100644 --- a/glance/db/sqlalchemy/migrate_repo/versions/031_remove_duplicated_locations.py +++ b/glance/db/sqlalchemy/migrate_repo/versions/031_remove_duplicated_locations.py @@ -33,11 +33,6 @@ def upgrade(migrate_engine): .where(image_locations.c.value == il.c.value) .where(image_locations.c.meta_data == il.c.meta_data) .where(image_locations.c.deleted == False))) - .where((sql.select([func.count(image_locations.c.id)]) - .where(image_locations.c.image_id == il.c.image_id) - .where(image_locations.c.value == il.c.value) - .where(image_locations.c.meta_data == il.c.meta_data) - .where(image_locations.c.deleted == False)) > 1) .where(il.c.deleted == False) .execute() )