]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
update ml2_migration to reflect optional methods
authorMark McClain <mmcclain@yahoo-inc.com>
Wed, 8 Oct 2014 19:38:19 +0000 (15:38 -0400)
committerMark McClain <mmcclain@yahoo-inc.com>
Wed, 8 Oct 2014 19:38:19 +0000 (15:38 -0400)
This change conditionally executes the schema methods for versions that
support them.

Change-Id: I8a51ac04e62dfcfe1e0a2e69a17664d154f0d1d7
Closes-Bug: #1378732

neutron/db/migration/migrate_to_ml2.py

index 97a187015326670aac5a2fa0cdac9067f4432cf8..fc5fa421674c23b1ab6fe08e164e21d8b43fb5a4 100755 (executable)
@@ -132,7 +132,8 @@ class BaseMigrateToMl2(object):
         metadata = sa.MetaData()
         check_db_schema_version(engine, metadata)
 
-        self.define_ml2_tables(metadata)
+        if hasattr(self, 'define_ml2_tables'):
+            self.define_ml2_tables(metadata)
 
         # Autoload the ports table to ensure that foreign keys to it and
         # the network table can be created for the new tables.
@@ -145,7 +146,8 @@ class BaseMigrateToMl2(object):
         self.migrate_vlan_allocations(engine)
         self.migrate_port_bindings(engine, metadata)
 
-        self.drop_old_tables(engine, save_tables)
+        if hasattr(self, 'drop_old_tables'):
+            self.drop_old_tables(engine, save_tables)
 
     def migrate_segment_dict(self, binding):
         binding['id'] = uuidutils.generate_uuid()