Merge "Remove table creation from the SQL driver"

This commit is contained in:
Jenkins 2017-02-26 22:03:08 +00:00 committed by Gerrit Code Review
commit 550e916600
4 changed files with 22 additions and 7 deletions

View File

@ -129,6 +129,8 @@ function configure_zaqar {
iniset $ZAQAR_CONF 'drivers:management_store:sqlalchemy' uri `database_connection_url zaqar`
iniset $ZAQAR_CONF 'drivers:management_store:sqlalchemy' database zaqar_mgmt
zaqar-sql-db-manage --config-file $ZAQAR_CONF upgrade head
iniset $ZAQAR_CONF drivers message_store redis
iniset $ZAQAR_CONF 'drivers:message_store:redis' uri redis://localhost:6379
iniset $ZAQAR_CONF 'drivers:message_store:redis' database zaqar
@ -139,6 +141,8 @@ function configure_zaqar {
iniset $ZAQAR_CONF 'drivers:management_store:sqlalchemy' uri `database_connection_url zaqar`
iniset $ZAQAR_CONF 'drivers:management_store:sqlalchemy' database zaqar_mgmt
zaqar-sql-db-manage --config-file $ZAQAR_CONF upgrade head
iniset $ZAQAR_CONF drivers message_store swift
iniset $ZAQAR_CONF 'drivers:message_store:swift' auth_url $KEYSTONE_AUTH_URI_V3
iniset $ZAQAR_CONF 'drivers:message_store:swift' uri swift://zaqar:$SERVICE_PASSWORD@/service

View File

@ -0,0 +1,7 @@
---
critical:
- |
When using the sqlalchemy driver, operators now are required to run
"zaqar-sql-db-manage upgrade" before making the service available. The
service previously tried to create the database on the first request, but
it was bound to race conditions.

View File

@ -23,7 +23,6 @@ from zaqar.common import decorators
from zaqar import storage
from zaqar.storage.sqlalchemy import controllers
from zaqar.storage.sqlalchemy import options
from zaqar.storage.sqlalchemy import tables
class ControlDriver(storage.ControlDriverBase):
@ -61,8 +60,6 @@ class ControlDriver(storage.ControlDriverBase):
sa.event.listen(engine, 'connect',
self._mysql_on_connect)
tables.metadata.create_all(engine, checkfirst=True)
if (self.conf.profiler.enabled and
self.conf.profiler.trace_message_store):
sa_tracer.add_tracing(sa, engine, "db")

View File

@ -16,33 +16,40 @@ import six
from zaqar.storage import sqlalchemy
from zaqar.storage.sqlalchemy import controllers
from zaqar.storage.sqlalchemy import tables
from zaqar.storage.sqlalchemy import utils
from zaqar import tests as testing
from zaqar.tests.unit.storage import base
class SqlalchemyQueueTests(base.QueueControllerTest):
class DBCreateMixin(object):
def _prepare_conf(self):
tables.metadata.create_all(self.driver.engine)
class SqlalchemyQueueTests(DBCreateMixin, base.QueueControllerTest):
driver_class = sqlalchemy.ControlDriver
config_file = 'wsgi_sqlalchemy.conf'
controller_class = controllers.QueueController
control_driver_class = sqlalchemy.ControlDriver
class SqlalchemyPoolsTest(base.PoolsControllerTest):
class SqlalchemyPoolsTest(DBCreateMixin, base.PoolsControllerTest):
config_file = 'wsgi_sqlalchemy.conf'
driver_class = sqlalchemy.ControlDriver
controller_class = controllers.PoolsController
control_driver_class = sqlalchemy.ControlDriver
class SqlalchemyCatalogueTest(base.CatalogueControllerTest):
class SqlalchemyCatalogueTest(DBCreateMixin, base.CatalogueControllerTest):
config_file = 'wsgi_sqlalchemy.conf'
driver_class = sqlalchemy.ControlDriver
controller_class = controllers.CatalogueController
control_driver_class = sqlalchemy.ControlDriver
class SqlalchemyFlavorsTest(base.FlavorsControllerTest):
class SqlalchemyFlavorsTest(DBCreateMixin, base.FlavorsControllerTest):
config_file = 'wsgi_sqlalchemy.conf'
driver_class = sqlalchemy.ControlDriver
controller_class = controllers.FlavorsController