summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2017-02-09 12:37:50 +0000
committerGerrit Code Review <review@openstack.org>2017-02-09 12:37:50 +0000
commit6067e8ba6d319460b880f610badd2f223a52989e (patch)
tree02b8429d6012c35a3e93e95d39d1ea1612d21f90
parent15c2ff534b1065f2c4d9f6245c84cc09a59e7a12 (diff)
parent4e371d0ca9e8ca1bf189768dfc2afc1d35bc1b7b (diff)
Merge "Use Glance API v2"
-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():