summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--deployment_scripts/puppet/modules/lma_collector/files/collectd/openstack_glance.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/deployment_scripts/puppet/modules/lma_collector/files/collectd/openstack_glance.py b/deployment_scripts/puppet/modules/lma_collector/files/collectd/openstack_glance.py
index bcb9712..4efe103 100644
--- a/deployment_scripts/puppet/modules/lma_collector/files/collectd/openstack_glance.py
+++ b/deployment_scripts/puppet/modules/lma_collector/files/collectd/openstack_glance.py
@@ -38,20 +38,19 @@ class GlanceStatsPlugin(openstack.CollectdPlugin):
38 def itermetrics(self): 38 def itermetrics(self):
39 39
40 def is_snap(d): 40 def is_snap(d):
41 return d.get('properties', {}).get('image_type') == 'snapshot' 41 return d.get('image_type') == 'snapshot'
42 42
43 def groupby(d): 43 def groupby(d):
44 p = 'public' if d.get('is_public', True) else 'private' 44 p = d['visibility']
45 status = d.get('status', 'unknown').lower() 45 status = d.get('status', 'unknown').lower()
46 if is_snap(d): 46 if is_snap(d):
47 return 'snapshots.%s.%s' % (p, status) 47 return 'snapshots.%s.%s' % (p, status)
48 return 'images.%s.%s' % (p, status) 48 return 'images.%s.%s' % (p, status)
49 49
50 images_details = self.get_objects_details('glance', 'images', 50 images_details = self.get_objects('glance', 'images',
51 api_version='v1', 51 api_version='v2',
52 params={}, 52 params={},
53 detail=True) 53 detail=False)
54
55 status = self.count_objects_group_by(images_details, 54 status = self.count_objects_group_by(images_details,
56 group_by_func=groupby) 55 group_by_func=groupby)
57 for s, nb in status.iteritems(): 56 for s, nb in status.iteritems():