Merge "setting request_node_count doesn't work"
This commit is contained in:
commit
7a24c4ba3a
@ -139,11 +139,11 @@ class Application(object):
|
|||||||
conf.get('max_large_object_get_time', '86400'))
|
conf.get('max_large_object_get_time', '86400'))
|
||||||
value = conf.get('request_node_count', '2 * replicas').lower().split()
|
value = conf.get('request_node_count', '2 * replicas').lower().split()
|
||||||
if len(value) == 1:
|
if len(value) == 1:
|
||||||
value = int(value[0])
|
rnc_value = int(value[0])
|
||||||
self.request_node_count = lambda replicas: value
|
self.request_node_count = lambda replicas: rnc_value
|
||||||
elif len(value) == 3 and value[1] == '*' and value[2] == 'replicas':
|
elif len(value) == 3 and value[1] == '*' and value[2] == 'replicas':
|
||||||
value = int(value[0])
|
rnc_value = int(value[0])
|
||||||
self.request_node_count = lambda replicas: value * replicas
|
self.request_node_count = lambda replicas: rnc_value * replicas
|
||||||
else:
|
else:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
'Invalid request_node_count value: %r' % ''.join(value))
|
'Invalid request_node_count value: %r' % ''.join(value))
|
||||||
@ -165,11 +165,12 @@ class Application(object):
|
|||||||
value = conf.get('write_affinity_node_count',
|
value = conf.get('write_affinity_node_count',
|
||||||
'2 * replicas').lower().split()
|
'2 * replicas').lower().split()
|
||||||
if len(value) == 1:
|
if len(value) == 1:
|
||||||
value = int(value[0])
|
wanc_value = int(value[0])
|
||||||
self.write_affinity_node_count = lambda replicas: value
|
self.write_affinity_node_count = lambda replicas: wanc_value
|
||||||
elif len(value) == 3 and value[1] == '*' and value[2] == 'replicas':
|
elif len(value) == 3 and value[1] == '*' and value[2] == 'replicas':
|
||||||
value = int(value[0])
|
wanc_value = int(value[0])
|
||||||
self.write_affinity_node_count = lambda replicas: value * replicas
|
self.write_affinity_node_count = \
|
||||||
|
lambda replicas: wanc_value * replicas
|
||||||
else:
|
else:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
'Invalid write_affinity_node_count value: %r' % ''.join(value))
|
'Invalid write_affinity_node_count value: %r' % ''.join(value))
|
||||||
|
@ -1779,6 +1779,14 @@ class TestObjectController(unittest.TestCase):
|
|||||||
resp = req.get_response(self.app)
|
resp = req.get_response(self.app)
|
||||||
self.assertEquals(resp.status_int, 503)
|
self.assertEquals(resp.status_int, 503)
|
||||||
|
|
||||||
|
def test_node_request_setting(self):
|
||||||
|
baseapp = proxy_server.Application({'request_node_count': '3'},
|
||||||
|
FakeMemcache(),
|
||||||
|
container_ring=FakeRing(),
|
||||||
|
account_ring=FakeRing(),
|
||||||
|
object_ring=FakeRing())
|
||||||
|
self.assertEquals(baseapp.request_node_count(3), 3)
|
||||||
|
|
||||||
def test_iter_nodes(self):
|
def test_iter_nodes(self):
|
||||||
with save_globals():
|
with save_globals():
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user