]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Fix DB2 upgrade problem for Remove Hyper-V plugin
authorXu Han Peng <xuhanp@cn.ibm.com>
Fri, 6 Mar 2015 10:30:30 +0000 (18:30 +0800)
committerXu Han Peng <xuhanp@cn.ibm.com>
Fri, 6 Mar 2015 10:30:30 +0000 (18:30 +0800)
The recently added upgrade script to remove hyperv
neutron plugin breaks upgrade on DB2. This fix solves
this problme by using "1" instead of "true" in sql
when db2 is engine.

Change-Id: I1afdf66c25dbea46588ee7b205fa6394b08c1de8
Closes-Bug: 1429058

neutron/db/migration/alembic_migrations/versions/2b801560a332_remove_hypervneutronplugin_tables.py

index ec92ce9577a1c4db0f07a66eefc6035c6c50ca28..aa6c46ef7cd18df56f993b826ebefe478ddebd4f 100644 (file)
@@ -66,10 +66,16 @@ def _migrate_segment_dict(binding):
 
 def _migrate_vlan_allocations():
     # Code similar to migrate_to_ml2.BaseMigrateToMl2.migrate_vlan_allocations
-    op.execute('INSERT INTO ml2_vlan_allocations '
-               'SELECT physical_network, vlan_id, allocated '
-               'FROM hyperv_vlan_allocations '
-               'WHERE allocated = TRUE')
+    if op.get_bind().engine.name == 'ibm_db_sa':
+        op.execute('INSERT INTO ml2_vlan_allocations '
+                   'SELECT physical_network, vlan_id, allocated '
+                   'FROM hyperv_vlan_allocations '
+                   'WHERE allocated = 1')
+    else:
+        op.execute('INSERT INTO ml2_vlan_allocations '
+                   'SELECT physical_network, vlan_id, allocated '
+                   'FROM hyperv_vlan_allocations '
+                   'WHERE allocated = TRUE')
 
 
 def _migrate_network_segments(engine):