-
# Copyright 2010-2011 OpenStack Foundation
# All Rights Reserved.
#
import cinder.db.migration as migration
import cinder.db.sqlalchemy.migrate_repo
from cinder.db.sqlalchemy.migration import versioning_api as migration_api
-from cinder.openstack.common import log as logging
from cinder import test
-LOG = logging.getLogger('cinder.tests.test_migrations')
-
def _get_connect_string(backend,
user="openstack_citest",
except Exception:
# intentionally catch all to handle exceptions even if we don't
# have any backend code loaded.
- LOG.exception("Backend %s is not available", backend)
return False
else:
connection.close()
# Load test databases from the config file. Only do this
# once. No need to re-run this on each test...
- LOG.debug('config_path is %s' % TestMigrations.CONFIG_FILE_PATH)
if not self.test_databases:
if os.path.exists(TestMigrations.CONFIG_FILE_PATH):
cp = ConfigParser.RawConfigParser()
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT, shell=True)
output = proc.communicate()[0]
- LOG.debug(output)
self.assertEqual(0, proc.returncode)
for key, engine in self.engines.items():
migration_api.upgrade(engine, TestMigrations.REPOSITORY,
migration.db_initial_version() + 1)
- LOG.debug('latest version is %s' % TestMigrations.REPOSITORY.latest)
-
for version in xrange(migration.db_initial_version() + 2,
TestMigrations.REPOSITORY.latest + 1):
# upgrade -> downgrade -> upgrade
if check:
check(engine, data)
except Exception:
- LOG.error("Failed to migrate to version %s on engine %s" %
- (version, engine))
raise
# migration 004 - change volume types to UUID