[share] Specify supported protocols

Since Manila has a number of different storage protocols,
manila-tempest-plugin uses 'enable_protocols' parameter
for skipping unsupported tests.
Currently, we override this parameter on each the job.

Change-Id: Ib28820939d0f19136a942c356008fe7996969d43
This commit is contained in:
lkuchlan 2020-05-24 12:36:55 +03:00
parent 7ee63b1517
commit cf00bfa46b
1 changed files with 14 additions and 6 deletions

View File

@ -23,8 +23,11 @@ from tempest.lib import exceptions
class ShareService(VersionedService): class ShareService(VersionedService):
def get_share_pools(self): def get_share_pools(self, detail=False):
body = self.do_get(self.service_url + '/scheduler-stats/pools') url = self.service_url + '/scheduler-stats/pools'
if detail:
url += '/detail'
body = self.do_get(url)
body = json.loads(body) body = json.loads(body)
return body return body
@ -35,16 +38,21 @@ class ShareService(VersionedService):
conf.set('share', 'max_api_microversion', m_vs['max_microversion']) conf.set('share', 'max_api_microversion', m_vs['max_microversion'])
try: try:
pools = self.get_share_pools()['pools'] pools = self.get_share_pools(detail=True)['pools']
except exceptions.Forbidden: except exceptions.Forbidden:
C.LOG.warning("User has no permissions to list back-end storage " C.LOG.warning("User has no permissions to list back-end storage "
"pools - storage back-ends can't be discovered.") "pools - storage back-ends can't be discovered.")
return return
if pools: if pools:
backends = [ backends = []
pool['backend'] for pool in pools enable_protocols = []
] for pool in pools:
backends.append(pool['backend'])
protocol = pool['capabilities']['storage_protocol'].lower()
enable_protocols.extend(protocol.split('_'))
conf.set('share', 'backend_names', ','.join(backends)) conf.set('share', 'backend_names', ','.join(backends))
conf.set('share', 'enable_protocols', ','.join(enable_protocols))
if len(backends) > 1: if len(backends) > 1:
conf.set('share', 'multi_backend', 'True') conf.set('share', 'multi_backend', 'True')