Don't register pool endpoints when pooling=False
We recently enabled admin_mode=True in devstack. This raised an issue with the way we register endpoints. The redis driver has no support for pooling yet and this made Zaqar fail when running in admin mode because it tried to register pool endpoints as well. Although this issue is a side-effect caused by the missing feature, it does represent an error and a need to improve the way endpoints are registered. Change-Id: I0f65bb25383b889048c900daa657121f64234663 Closes-bug: #1399554
This commit is contained in:
parent
cb45cc6fa9
commit
1370e9b27a
@ -1,6 +1,13 @@
|
||||
[DEFAULT]
|
||||
pooling = True
|
||||
admin_mode = True
|
||||
|
||||
[drivers]
|
||||
transport = wsgi
|
||||
storage = sqlalchemy
|
||||
|
||||
[drivers:transport:wsgi]
|
||||
bind = 0.0.0.0
|
||||
port = 8888
|
||||
workers = 20
|
||||
|
||||
|
@ -80,14 +80,14 @@ class Driver(transport.DriverBase):
|
||||
"""Initialize hooks and URI routes to resources."""
|
||||
|
||||
catalog = [
|
||||
('/v1', v1_0.public_endpoints(self)),
|
||||
('/v1.1', v1_1.public_endpoints(self)),
|
||||
('/v1', v1_0.public_endpoints(self, self._conf)),
|
||||
('/v1.1', v1_1.public_endpoints(self, self._conf)),
|
||||
]
|
||||
|
||||
if self._conf.admin_mode:
|
||||
catalog.extend([
|
||||
('/v1', v1_0.private_endpoints(self)),
|
||||
('/v1.1', v1_1.private_endpoints(self)),
|
||||
('/v1', v1_0.private_endpoints(self, self._conf)),
|
||||
('/v1.1', v1_1.private_endpoints(self, self._conf)),
|
||||
])
|
||||
|
||||
self.app = falcon.API(before=self.before_hooks)
|
||||
|
@ -22,7 +22,7 @@ from zaqar.queues.transport.wsgi.v1_0 import queues
|
||||
from zaqar.queues.transport.wsgi.v1_0 import stats
|
||||
|
||||
|
||||
def public_endpoints(driver):
|
||||
def public_endpoints(driver, conf):
|
||||
queue_controller = driver._storage.queue_controller
|
||||
message_controller = driver._storage.message_controller
|
||||
claim_controller = driver._storage.claim_controller
|
||||
@ -69,7 +69,10 @@ def public_endpoints(driver):
|
||||
]
|
||||
|
||||
|
||||
def private_endpoints(driver):
|
||||
def private_endpoints(driver, conf):
|
||||
if not conf.pooling:
|
||||
return []
|
||||
|
||||
pools_controller = driver._control.pools_controller
|
||||
|
||||
return [
|
||||
|
@ -23,7 +23,7 @@ from zaqar.queues.transport.wsgi.v1_1 import queues
|
||||
from zaqar.queues.transport.wsgi.v1_1 import stats
|
||||
|
||||
|
||||
def public_endpoints(driver):
|
||||
def public_endpoints(driver, conf):
|
||||
queue_controller = driver._storage.queue_controller
|
||||
message_controller = driver._storage.message_controller
|
||||
claim_controller = driver._storage.claim_controller
|
||||
@ -76,20 +76,27 @@ def public_endpoints(driver):
|
||||
]
|
||||
|
||||
|
||||
def private_endpoints(driver):
|
||||
pools_controller = driver._control.pools_controller
|
||||
flavors_controller = driver._control.flavors_controller
|
||||
def private_endpoints(driver, conf):
|
||||
|
||||
return [
|
||||
('/pools',
|
||||
pools.Listing(pools_controller)),
|
||||
('/pools/{pool}',
|
||||
pools.Resource(pools_controller)),
|
||||
catalogue = [
|
||||
# Health
|
||||
('/health',
|
||||
health.Resource(driver._storage)),
|
||||
('/flavors',
|
||||
flavors.Listing(flavors_controller)),
|
||||
('/flavors/{flavor}',
|
||||
flavors.Resource(flavors_controller)),
|
||||
]
|
||||
|
||||
if conf.pooling:
|
||||
pools_controller = driver._control.pools_controller
|
||||
flavors_controller = driver._control.flavors_controller
|
||||
|
||||
catalogue.extend([
|
||||
('/pools',
|
||||
pools.Listing(pools_controller)),
|
||||
('/pools/{pool}',
|
||||
pools.Resource(pools_controller)),
|
||||
('/flavors',
|
||||
flavors.Listing(flavors_controller)),
|
||||
('/flavors/{flavor}',
|
||||
flavors.Resource(flavors_controller)),
|
||||
])
|
||||
|
||||
return catalogue
|
||||
|
@ -323,7 +323,7 @@ class PoolsBaseTest(base.V1Base):
|
||||
|
||||
class TestPoolsMongoDB(PoolsBaseTest):
|
||||
|
||||
config_file = 'wsgi_mongodb.conf'
|
||||
config_file = 'wsgi_mongodb_pooled.conf'
|
||||
|
||||
@testing.requires_mongodb
|
||||
def setUp(self):
|
||||
@ -332,7 +332,7 @@ class TestPoolsMongoDB(PoolsBaseTest):
|
||||
|
||||
class TestPoolsSqlalchemy(PoolsBaseTest):
|
||||
|
||||
config_file = 'wsgi_sqlalchemy.conf'
|
||||
config_file = 'wsgi_sqlalchemy_pooled.conf'
|
||||
|
||||
def setUp(self):
|
||||
super(TestPoolsSqlalchemy, self).setUp()
|
||||
|
@ -327,7 +327,7 @@ class PoolsBaseTest(base.V1_1Base):
|
||||
|
||||
class TestPoolsMongoDB(PoolsBaseTest):
|
||||
|
||||
config_file = 'wsgi_mongodb.conf'
|
||||
config_file = 'wsgi_mongodb_pooled.conf'
|
||||
|
||||
@testing.requires_mongodb
|
||||
def setUp(self):
|
||||
@ -336,7 +336,7 @@ class TestPoolsMongoDB(PoolsBaseTest):
|
||||
|
||||
class TestPoolsSqlalchemy(PoolsBaseTest):
|
||||
|
||||
config_file = 'wsgi_sqlalchemy.conf'
|
||||
config_file = 'wsgi_sqlalchemy_pooled.conf'
|
||||
|
||||
def setUp(self):
|
||||
super(TestPoolsSqlalchemy, self).setUp()
|
||||
|
Loading…
x
Reference in New Issue
Block a user