update ml2_migration to reflect optional methods

This change conditionally executes the schema methods for versions that
support them.

Change-Id: I8a51ac04e62dfcfe1e0a2e69a17664d154f0d1d7
Closes-Bug: #1378732
This commit is contained in:
Mark McClain 2014-10-08 15:38:19 -04:00
parent d217543ea0
commit dd35d64812
1 changed files with 4 additions and 2 deletions

View File

@ -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()