Manila: Add snapshot capabilities in [share]

Makes configuration convenient when we can
discover and set these values by default.

Signed-off-by: Goutham Pacha Ravi <gouthampravi@gmail.com>
Change-Id: Iecb1328f1fb3d54cfd91bb9c23d2d8ee40cf3b33
This commit is contained in:
Goutham Pacha Ravi 2021-04-08 10:17:02 -07:00
parent 677d9c8e4e
commit b15c290af1
1 changed files with 18 additions and 2 deletions

View File

@ -47,11 +47,18 @@ class ShareService(VersionedService):
backends = set()
enable_protocols = set()
dhss = set()
capability_snapshot_support = set()
capability_create_share_from_snapshot_support = set()
for pool in pools:
backends.add(pool['backend'])
protocol = pool['capabilities']['storage_protocol'].lower()
pool_capabilities = pool['capabilities']
protocol = pool_capabilities['storage_protocol'].lower()
enable_protocols.update(protocol.split('_'))
dhss.add(pool['capabilities']['driver_handles_share_servers'])
dhss.add(pool_capabilities['driver_handles_share_servers'])
capability_snapshot_support.add(
pool_capabilities['snapshot_support'])
capability_create_share_from_snapshot_support.add(
pool_capabilities['create_share_from_snapshot_support'])
conf.set('share', 'backend_names', ','.join(backends))
conf.set('share', 'enable_protocols', ','.join(enable_protocols))
@ -61,6 +68,15 @@ class ShareService(VersionedService):
# not both at the same time. Lets err on the side of caution and
# set this to True if any DHSS=True backend is present.
conf.set('share', 'multitenancy_enabled', str(any(dhss)))
# Optional capabilities/features:
conf.set('share', 'run_snapshot_tests',
str(any(capability_snapshot_support)))
conf.set('share', 'capability_snapshot_support',
str(any(capability_snapshot_support)))
conf.set('share', 'capability_create_share_from_snapshot_support',
str(any(capability_create_share_from_snapshot_support)))
if len(backends) > 1:
conf.set('share', 'multi_backend', 'True')