CLIENT_ID_QUERY = {
'key_descriptor': [
- {'type': 'client_id', 'regex': '^.+$'},
+ {'type': 'client_id', 'regex': '^(.+)$'},
],
'performance_counter_descriptors': [
'bytes', 'write_ops', 'read_ops', 'write_bytes', 'read_bytes',
RBD_IMAGE_ID_QUERY = {
'key_descriptor': [
- {'type': 'pool_id', 'regex': '^.+$'},
+ {'type': 'pool_id', 'regex': '^(.+)$'},
{'type': 'object_name', 'regex': '^rbd_data\.([^.]+)\.'},
],
'performance_counter_descriptors': [
ALL_SUBKEYS_QUERY = {
'key_descriptor': [
- {'type': 'client_id', 'regex': '^.*$'},
- {'type': 'client_address', 'regex': '^.*$'},
- {'type': 'pool_id', 'regex': '^.*$'},
- {'type': 'namespace', 'regex': '^.*$'},
- {'type': 'osd_id', 'regex': '^.*$'},
- {'type': 'pg_id', 'regex': '^.*$'},
- {'type': 'object_name', 'regex': '^.*$'},
- {'type': 'snap_id', 'regex': '^.*$'},
+ {'type': 'client_id', 'regex': '^(.*)$'},
+ {'type': 'client_address', 'regex': '^(.*)$'},
+ {'type': 'pool_id', 'regex': '^(.*)$'},
+ {'type': 'namespace', 'regex': '^(.*)$'},
+ {'type': 'osd_id', 'regex': '^(.*)$'},
+ {'type': 'pg_id', 'regex': '^(.*)$'},
+ {'type': 'object_name', 'regex': '^(.*)$'},
+ {'type': 'snap_id', 'regex': '^(.*)$'},
],
'performance_counter_descriptors': [
'write_ops', 'read_ops',
i = descriptors.index(query['limit']['order_by'])
res['counters'].sort(key=lambda x: x['c'][i], reverse=True)
for c in res['counters'][:max_count]:
- if query == self.RBD_IMAGE_ID_QUERY:
- row = [c['k'][0][0], c['k'][1][1]]
- else:
- row = [sk[0] for sk in c['k']]
+ row = [sk[0] for sk in c['k']]
counters = c['c']
for i in range(len(descriptors)):
if descriptors[i] in ['bytes']:
pool_ids = list(self.rbd_stats['pools'])
pool_ids.sort()
- pool_id_regex = '|'.join(['^%s$' % x for x in pool_ids])
+ pool_id_regex = '^(' + '|'.join([str(x) for x in pool_ids]) + ')$'
if 'query' in self.rbd_stats and \
pool_id_regex != self.rbd_stats['query']['key_descriptor'][0]['regex']:
for c in res['counters']:
# if the pool id is not found in the object name use id of the
# pool where the object is located
- if c['k'][1][1]:
- pool_id = int(c['k'][1][1])
+ if c['k'][1][0]:
+ pool_id = int(c['k'][1][0])
else:
pool_id = int(c['k'][0][0])
if pool_id not in self.rbd_stats['pools'] and not pools_refreshed:
pools_refreshed = True
if pool_id not in self.rbd_stats['pools']:
continue
- image_id = c['k'][1][2]
+ image_id = c['k'][1][1]
pool = self.rbd_stats['pools'][pool_id]
if image_id not in pool['images'] and not pools_refreshed:
self.refresh_rbd_stats_pools(pools)