From f8d49ae61021e1ad2aaaf2555c4954ba0e3dc026 Mon Sep 17 00:00:00 2001 From: John Griffith Date: Tue, 18 Sep 2012 13:29:20 -0600 Subject: [PATCH] Add nova migrate_version check to cinder import Cinder-manage migrate import only works from Nova/Folsom--->Cinder/Folsom this change adds an explicit check of the nova migrate_version (133) to make sure we have all of the volume id/uuid changes that are needed to be compatable, and presents an error message if that's not the case. Addresses bug #1052598 Change-Id: I7f32cf35e33320f4348b7bc44a8e92b5716b71d8 (cherry picked from commit 321d32379cd6044378f2f9c32c068de18f514df5) --- bin/cinder-manage | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/bin/cinder-manage b/bin/cinder-manage index 8f4a4c3dc..9d1321742 100755 --- a/bin/cinder-manage +++ b/bin/cinder-manage @@ -251,9 +251,11 @@ class ImportCommands(object): return Mapper def _open_session(self, con_info): + # Note(jdg): The echo option below sets whether to dispaly db command + # debug info. engine = create_engine(con_info, convert_unicode=True, - echo=True) + echo=False) session = sessionmaker(bind=engine) return (session(), engine) @@ -295,6 +297,14 @@ class ImportCommands(object): src_meta = MetaData(bind=src_engine) (dest, dest_engine) = self._open_session(dest_db) + # First make sure nova is at Folsom + table = Table('migrate_version', src_meta, autoload=True) + if src.query(table).first().version < 132: + print (_('ERROR: Specified Nova DB is not at a compatible ' + 'migration version!\nNova must be at Folsom or newer ' + 'to import into Cinder database.')) + sys.exit(2) + for table_name in table_list: print (_('Importing table %s...') % table_name) table = Table(table_name, src_meta, autoload=True) -- 2.45.2