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
This commit is contained in:
parent
45e67e8b77
commit
321d32379c
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user