Allow to skip metering/event database upgrade

Change-Id: Ib14e0324a02e78e7814d459f3e47d23e840db548
This commit is contained in:
Mehdi Abaakouk 2016-08-03 16:06:32 +02:00
parent 18c181f0b3
commit a60b004fd6

View File

@ -28,9 +28,27 @@ LOG = log.getLogger(__name__)
def upgrade():
cfg.CONF.register_cli_opts([
cfg.BoolOpt('skip-metering-database',
help='Skip metering database upgrade.',
default=False),
cfg.BoolOpt('skip-event-database',
help='Skip event database upgrade.',
default=False),
])
service.prepare_service()
storage.get_connection_from_config(cfg.CONF, 'metering').upgrade()
storage.get_connection_from_config(cfg.CONF, 'event').upgrade()
if cfg.CONF.skip_metering_database:
LOG.info("Skipping metering database upgrade")
else:
LOG.debug("Upgrading metering database")
storage.get_connection_from_config(cfg.CONF, 'metering').upgrade()
if cfg.CONF.skip_event_database:
LOG.info("Skipping event database upgrade")
else:
LOG.debug("Upgrading event database")
storage.get_connection_from_config(cfg.CONF, 'event').upgrade()
def dbsync():