summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSwann Croiset <scroiset@mirantis.com>2017-01-31 16:20:58 +0100
committerSwann Croiset <scroiset@mirantis.com>2017-02-07 11:23:06 +0100
commit4e371d0ca9e8ca1bf189768dfc2afc1d35bc1b7b (patch)
tree61d7960acfe5622c01413a99330a0f344c44b8cb
parent88d7bb28b31f6807172969522a2a1dedd80e0c53 (diff)
Use Glance API v2
Notes
Notes (review): Code-Review+1: Olivier Bourdon <obourdon@mirantis.com> Code-Review+2: Simon Pasquier <spasquier@mirantis.com> Code-Review+2: Swann Croiset <scroiset@mirantis.com> Workflow+1: Swann Croiset <scroiset@mirantis.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Thu, 09 Feb 2017 12:37:50 +0000 Reviewed-on: https://review.openstack.org/427679 Project: openstack/fuel-plugin-lma-collector Branch: refs/heads/master
-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():