Fix failing of listing services

Non admin user or a user with no such privileges can't list
services. Therefor cinder-backup and metering services can't
be discovered for such a user.
The patch adds a warning to inform the user.

Change-Id: I48119b7a48f49f58dfac7bf34c75a08681b9ae32
This commit is contained in:
Martin Kopec 2018-04-04 15:03:51 +00:00
parent 6a10dbb153
commit c1951c379e
1 changed files with 13 additions and 3 deletions

View File

@ -512,7 +512,12 @@ def create_tempest_images(client, conf, image_path, allow_creation,
def check_ceilometer_service(client, conf, services):
services = client.list_services(**{'type': 'metering'})
try:
services = client.list_services(**{'type': 'metering'})
except exceptions.Forbidden:
LOG.warning("User has no permissions to list services - "
"metering service can't be discovered.")
return
if services and len(services['services']):
metering = services['services'][0]
if 'ceilometer' in metering['name'] and metering['enabled']:
@ -524,8 +529,13 @@ def check_volume_backup_service(client, conf, services):
if 'volumev3' not in services:
LOG.info("No volume service found, skipping backup service check")
return
params = {'binary': 'cinder-backup'}
backup_service = client.list_services(**params)
try:
params = {'binary': 'cinder-backup'}
backup_service = client.list_services(**params)
except exceptions.Forbidden:
LOG.warning("User has no permissions to list services - "
"cinder-backup service can't be discovered.")
return
if backup_service:
# We only set backup to false if the service isn't running otherwise we