Browse Source

Merge "Use Glance API v2"

changes/50/427750/7
Jenkins 2 years ago
parent
commit
6067e8ba6d

+ 6
- 7
deployment_scripts/puppet/modules/lma_collector/files/collectd/openstack_glance.py View File

@@ -38,20 +38,19 @@ class GlanceStatsPlugin(openstack.CollectdPlugin):
38 38
     def itermetrics(self):
39 39
 
40 40
         def is_snap(d):
41
-            return d.get('properties', {}).get('image_type') == 'snapshot'
41
+            return d.get('image_type') == 'snapshot'
42 42
 
43 43
         def groupby(d):
44
-            p = 'public' if d.get('is_public', True) else 'private'
44
+            p = d['visibility']
45 45
             status = d.get('status', 'unknown').lower()
46 46
             if is_snap(d):
47 47
                 return 'snapshots.%s.%s' % (p, status)
48 48
             return 'images.%s.%s' % (p, status)
49 49
 
50
-        images_details = self.get_objects_details('glance', 'images',
51
-                                                  api_version='v1',
52
-                                                  params={},
53
-                                                  detail=True)
54
-
50
+        images_details = self.get_objects('glance', 'images',
51
+                                          api_version='v2',
52
+                                          params={},
53
+                                          detail=False)
55 54
         status = self.count_objects_group_by(images_details,
56 55
                                              group_by_func=groupby)
57 56
         for s, nb in status.iteritems():

Loading…
Cancel
Save