Fix libvirt plugin project/tenant name dimension
Enabling the libvirt plugin to add tenant_name as a dimension is resulting in "Unable to get tenant list from keystone: Unknown Attribute: tenants" when using keystone v3. This is due the v3 keystone client uses projects.list() instead of tenants.list(). This change fixes that by checking which client version is being used and making the function call accordingly. Change-Id: Icfe88b6a1a7ef193fd998db5a72a7a076d23ffe5
This commit is contained in:
parent
9ff337881b
commit
8a9de631cf
@ -42,7 +42,10 @@ def get_tenant_list(config, log):
|
||||
try:
|
||||
log.debug("Retrieving Keystone tenant list")
|
||||
client = keystone.get_client(**config)
|
||||
tenants = client.tenants.list()
|
||||
if 'v2' in client.__module__:
|
||||
tenants = client.tenants.list()
|
||||
else:
|
||||
tenants = client.projects.list()
|
||||
except Exception as e:
|
||||
msg = "Unable to get tenant list from keystone: {0}"
|
||||
log.error(msg.format(e))
|
||||
|
Loading…
Reference in New Issue
Block a user