Browse Source

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
changes/65/431565/6
Danil Akhmetov 3 years ago
parent
commit
bc797dfb4b
2 changed files with 8 additions and 9 deletions
  1. +5
    -6
      deployment_scripts/puppet/modules/lma_collector/files/collectd/collectd_openstack.py
  2. +3
    -3
      deployment_scripts/puppet/modules/lma_collector/files/collectd/openstack_keystone.py

+ 5
- 6
deployment_scripts/puppet/modules/lma_collector/files/collectd/collectd_openstack.py View File

@@ -169,12 +169,11 @@ class CollectdPlugin(base.Base):

def _build_url(self, service, resource):
s = (self.get_service(service) or {})
# the adminURL must be used to access resources with Keystone API v2
if service == 'keystone' and \
(resource in ['tenants', 'users'] or 'OS-KS' in resource):
url = s.get('admin_url')
else:
url = s.get('url')
url = s.get('url')
# v3 API must be used in order to obtain tenants in multi-domain envs
if service == 'keystone' and (resource in ['projects',
'users', 'roles']):
url = url.replace('v2.0', 'v3')

if url:
if url[-1] != '/':

+ 3
- 3
deployment_scripts/puppet/modules/lma_collector/files/collectd/openstack_keystone.py View File

@@ -40,11 +40,11 @@ class KeystoneStatsPlugin(openstack.CollectdPlugin):
return 'enabled' if d.get('enabled') else 'disabled'

# tenants
r = self.get('keystone', 'tenants')
r = self.get('keystone', 'projects')
if not r:
self.logger.warning('Could not find Keystone tenants')
return
tenants_details = r.json().get('tenants', [])
tenants_details = r.json().get('projects', [])
status = self.count_objects_group_by(tenants_details,
group_by_func=groupby)
for s, nb in status.iteritems():
@@ -70,7 +70,7 @@ class KeystoneStatsPlugin(openstack.CollectdPlugin):
}

# roles
r = self.get('keystone', 'OS-KSADM/roles')
r = self.get('keystone', 'roles')
if not r:
self.logger.warning('Could not find Keystone roles')
return

Loading…
Cancel
Save