From dd35d64812fd0ad02e7a00432073d141049e7107 Mon Sep 17 00:00:00 2001 From: Mark McClain Date: Wed, 8 Oct 2014 15:38:19 -0400 Subject: [PATCH] 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 --- neutron/db/migration/migrate_to_ml2.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/neutron/db/migration/migrate_to_ml2.py b/neutron/db/migration/migrate_to_ml2.py index 97a18701532..fc5fa421674 100755 --- a/neutron/db/migration/migrate_to_ml2.py +++ b/neutron/db/migration/migrate_to_ml2.py @@ -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()