summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanil Akhmetov <dakhmetov@mirantis.com>2017-02-09 16:54:05 +0300
committerDanil Akhmetov <dakhmetov@mirantis.com>2017-02-13 20:11:57 +0300
commitbc797dfb4bdb091627226cf058469f0787fa284c (patch)
tree54b872888647fc933ab02ad6462d0128781d29ec
parent3a2c9ce00277bde6e0fca5fdaf2b6439f347f45c (diff)
Enable Keystone v3 API when obtaining users and tenants
Always use Keystone v3 API obtaining users and projects in order to list all users and tenants in multi-domain environments. Change-Id: If94ad4a0d61d0467031b384d132eb433682b3a20 Closes-Bug: #1662142
Notes
Notes (review): Code-Review+2: Simon Pasquier <spasquier@mirantis.com> Code-Review+1: Olivier Bourdon <obourdon@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: Tue, 14 Feb 2017 11:05:35 +0000 Reviewed-on: https://review.openstack.org/431565 Project: openstack/fuel-plugin-lma-collector Branch: refs/heads/master
-rw-r--r--deployment_scripts/puppet/modules/lma_collector/files/collectd/collectd_openstack.py11
-rw-r--r--deployment_scripts/puppet/modules/lma_collector/files/collectd/openstack_keystone.py6
2 files changed, 8 insertions, 9 deletions
diff --git a/deployment_scripts/puppet/modules/lma_collector/files/collectd/collectd_openstack.py b/deployment_scripts/puppet/modules/lma_collector/files/collectd/collectd_openstack.py
index a8fa999..1aeeb36 100644
--- a/deployment_scripts/puppet/modules/lma_collector/files/collectd/collectd_openstack.py
+++ b/deployment_scripts/puppet/modules/lma_collector/files/collectd/collectd_openstack.py
@@ -169,12 +169,11 @@ class CollectdPlugin(base.Base):
169 169
170 def _build_url(self, service, resource): 170 def _build_url(self, service, resource):
171 s = (self.get_service(service) or {}) 171 s = (self.get_service(service) or {})
172 # the adminURL must be used to access resources with Keystone API v2 172 url = s.get('url')
173 if service == 'keystone' and \ 173 # v3 API must be used in order to obtain tenants in multi-domain envs
174 (resource in ['tenants', 'users'] or 'OS-KS' in resource): 174 if service == 'keystone' and (resource in ['projects',
175 url = s.get('admin_url') 175 'users', 'roles']):
176 else: 176 url = url.replace('v2.0', 'v3')
177 url = s.get('url')
178 177
179 if url: 178 if url:
180 if url[-1] != '/': 179 if url[-1] != '/':
diff --git a/deployment_scripts/puppet/modules/lma_collector/files/collectd/openstack_keystone.py b/deployment_scripts/puppet/modules/lma_collector/files/collectd/openstack_keystone.py
index b84fbc6..e631baf 100644
--- a/deployment_scripts/puppet/modules/lma_collector/files/collectd/openstack_keystone.py
+++ b/deployment_scripts/puppet/modules/lma_collector/files/collectd/openstack_keystone.py
@@ -40,11 +40,11 @@ class KeystoneStatsPlugin(openstack.CollectdPlugin):
40 return 'enabled' if d.get('enabled') else 'disabled' 40 return 'enabled' if d.get('enabled') else 'disabled'
41 41
42 # tenants 42 # tenants
43 r = self.get('keystone', 'tenants') 43 r = self.get('keystone', 'projects')
44 if not r: 44 if not r:
45 self.logger.warning('Could not find Keystone tenants') 45 self.logger.warning('Could not find Keystone tenants')
46 return 46 return
47 tenants_details = r.json().get('tenants', []) 47 tenants_details = r.json().get('projects', [])
48 status = self.count_objects_group_by(tenants_details, 48 status = self.count_objects_group_by(tenants_details,
49 group_by_func=groupby) 49 group_by_func=groupby)
50 for s, nb in status.iteritems(): 50 for s, nb in status.iteritems():
@@ -70,7 +70,7 @@ class KeystoneStatsPlugin(openstack.CollectdPlugin):
70 } 70 }
71 71
72 # roles 72 # roles
73 r = self.get('keystone', 'OS-KSADM/roles') 73 r = self.get('keystone', 'roles')
74 if not r: 74 if not r:
75 self.logger.warning('Could not find Keystone roles') 75 self.logger.warning('Could not find Keystone roles')
76 return 76 return