Merge "Replacing six.iter/dict.iter usages"
This commit is contained in:
commit
9bf1360f88
@ -738,27 +738,27 @@ the ring and its testing.
|
|||||||
desired_count = \
|
desired_count = \
|
||||||
DATA_ID_COUNT / len(ring.nodes) * REPLICAS
|
DATA_ID_COUNT / len(ring.nodes) * REPLICAS
|
||||||
print '%d: Desired data ids per node' % desired_count
|
print '%d: Desired data ids per node' % desired_count
|
||||||
max_count = max(node_counts.itervalues())
|
max_count = max(node_counts.values())
|
||||||
over = \
|
over = \
|
||||||
100.0 * (max_count - desired_count) / desired_count
|
100.0 * (max_count - desired_count) / desired_count
|
||||||
print '%d: Most data ids on one node, %.02f%% over' % \
|
print '%d: Most data ids on one node, %.02f%% over' % \
|
||||||
(max_count, over)
|
(max_count, over)
|
||||||
min_count = min(node_counts.itervalues())
|
min_count = min(node_counts.values())
|
||||||
under = \
|
under = \
|
||||||
100.0 * (desired_count - min_count) / desired_count
|
100.0 * (desired_count - min_count) / desired_count
|
||||||
print '%d: Least data ids on one node, %.02f%% under' % \
|
print '%d: Least data ids on one node, %.02f%% under' % \
|
||||||
(min_count, under)
|
(min_count, under)
|
||||||
zone_count = \
|
zone_count = \
|
||||||
len(set(n['zone'] for n in ring.nodes.itervalues()))
|
len(set(n['zone'] for n in ring.nodes.values()))
|
||||||
desired_count = \
|
desired_count = \
|
||||||
DATA_ID_COUNT / zone_count * ring.replicas
|
DATA_ID_COUNT / zone_count * ring.replicas
|
||||||
print '%d: Desired data ids per zone' % desired_count
|
print '%d: Desired data ids per zone' % desired_count
|
||||||
max_count = max(zone_counts.itervalues())
|
max_count = max(zone_counts.values())
|
||||||
over = \
|
over = \
|
||||||
100.0 * (max_count - desired_count) / desired_count
|
100.0 * (max_count - desired_count) / desired_count
|
||||||
print '%d: Most data ids in one zone, %.02f%% over' % \
|
print '%d: Most data ids in one zone, %.02f%% over' % \
|
||||||
(max_count, over)
|
(max_count, over)
|
||||||
min_count = min(zone_counts.itervalues())
|
min_count = min(zone_counts.values())
|
||||||
under = \
|
under = \
|
||||||
100.0 * (desired_count - min_count) / desired_count
|
100.0 * (desired_count - min_count) / desired_count
|
||||||
print '%d: Least data ids in one zone, %.02f%% under' % \
|
print '%d: Least data ids in one zone, %.02f%% under' % \
|
||||||
@ -846,19 +846,19 @@ we've changed so much I'll just post the entire module again:
|
|||||||
begin = time()
|
begin = time()
|
||||||
parts = 2 ** partition_power
|
parts = 2 ** partition_power
|
||||||
total_weight = \
|
total_weight = \
|
||||||
float(sum(n['weight'] for n in nodes.itervalues()))
|
float(sum(n['weight'] for n in nodes.values()))
|
||||||
for node in nodes.itervalues():
|
for node in nodes.values():
|
||||||
node['desired_parts'] = \
|
node['desired_parts'] = \
|
||||||
parts / total_weight * node['weight']
|
parts / total_weight * node['weight']
|
||||||
part2node = array('H')
|
part2node = array('H')
|
||||||
for part in xrange(2 ** partition_power):
|
for part in xrange(2 ** partition_power):
|
||||||
for node in nodes.itervalues():
|
for node in nodes.values():
|
||||||
if node['desired_parts'] >= 1:
|
if node['desired_parts'] >= 1:
|
||||||
node['desired_parts'] -= 1
|
node['desired_parts'] -= 1
|
||||||
part2node.append(node['id'])
|
part2node.append(node['id'])
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
for node in nodes.itervalues():
|
for node in nodes.values():
|
||||||
if node['desired_parts'] >= 0:
|
if node['desired_parts'] >= 0:
|
||||||
node['desired_parts'] -= 1
|
node['desired_parts'] -= 1
|
||||||
part2node.append(node['id'])
|
part2node.append(node['id'])
|
||||||
@ -881,10 +881,10 @@ we've changed so much I'll just post the entire module again:
|
|||||||
zone_counts.get(node['zone'], 0) + 1
|
zone_counts.get(node['zone'], 0) + 1
|
||||||
print '%ds to test ring' % (time() - begin)
|
print '%ds to test ring' % (time() - begin)
|
||||||
total_weight = float(sum(n['weight'] for n in
|
total_weight = float(sum(n['weight'] for n in
|
||||||
ring.nodes.itervalues()))
|
ring.nodes.values()))
|
||||||
max_over = 0
|
max_over = 0
|
||||||
max_under = 0
|
max_under = 0
|
||||||
for node in ring.nodes.itervalues():
|
for node in ring.nodes.values():
|
||||||
desired = DATA_ID_COUNT * REPLICAS * \
|
desired = DATA_ID_COUNT * REPLICAS * \
|
||||||
node['weight'] / total_weight
|
node['weight'] / total_weight
|
||||||
diff = node_counts[node['id']] - desired
|
diff = node_counts[node['id']] - desired
|
||||||
@ -901,9 +901,9 @@ we've changed so much I'll just post the entire module again:
|
|||||||
max_over = 0
|
max_over = 0
|
||||||
max_under = 0
|
max_under = 0
|
||||||
for zone in set(n['zone'] for n in
|
for zone in set(n['zone'] for n in
|
||||||
ring.nodes.itervalues()):
|
ring.nodes.values()):
|
||||||
zone_weight = sum(n['weight'] for n in
|
zone_weight = sum(n['weight'] for n in
|
||||||
ring.nodes.itervalues() if n['zone'] == zone)
|
ring.nodes.values() if n['zone'] == zone)
|
||||||
desired = DATA_ID_COUNT * REPLICAS * \
|
desired = DATA_ID_COUNT * REPLICAS * \
|
||||||
zone_weight / total_weight
|
zone_weight / total_weight
|
||||||
diff = zone_counts[zone] - desired
|
diff = zone_counts[zone] - desired
|
||||||
|
@ -199,7 +199,7 @@ def headers_to_object_info(headers, status_int=HTTP_OK):
|
|||||||
"""
|
"""
|
||||||
headers, meta, sysmeta = _prep_headers_to_info(headers, 'object')
|
headers, meta, sysmeta = _prep_headers_to_info(headers, 'object')
|
||||||
transient_sysmeta = {}
|
transient_sysmeta = {}
|
||||||
for key, val in six.iteritems(headers):
|
for key, val in headers.items():
|
||||||
if is_object_transient_sysmeta(key):
|
if is_object_transient_sysmeta(key):
|
||||||
key = strip_object_transient_sysmeta_prefix(key.lower())
|
key = strip_object_transient_sysmeta_prefix(key.lower())
|
||||||
transient_sysmeta[key] = val
|
transient_sysmeta[key] = val
|
||||||
|
@ -3025,7 +3025,7 @@ class BaseClient(object):
|
|||||||
class KeystoneClient(BaseClient):
|
class KeystoneClient(BaseClient):
|
||||||
def get_id_info(self):
|
def get_id_info(self):
|
||||||
id_info = {}
|
id_info = {}
|
||||||
for user_name, user_info in self.users.iteritems():
|
for user_name, user_info in self.users.items():
|
||||||
if user_name != '':
|
if user_name != '':
|
||||||
user_id, project_id = self._get_id(user_name)
|
user_id, project_id = self._get_id(user_name)
|
||||||
id_info[user_name + '_id'] = user_id
|
id_info[user_name + '_id'] = user_id
|
||||||
@ -3294,7 +3294,7 @@ class TestContainerACL(BaseTestAC):
|
|||||||
test_case = super(TestContainerACL, self)._convert_data(data)
|
test_case = super(TestContainerACL, self)._convert_data(data)
|
||||||
prep_container_header = test_case['prep_container_header']
|
prep_container_header = test_case['prep_container_header']
|
||||||
if prep_container_header is not None:
|
if prep_container_header is not None:
|
||||||
for header, header_val in prep_container_header.iteritems():
|
for header, header_val in prep_container_header.items():
|
||||||
prep_container_header[header] = header_val % self.id_info
|
prep_container_header[header] = header_val % self.id_info
|
||||||
return test_case
|
return test_case
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user