Merge "Adds 'all_tenants' search option in volumeprovider/cinder.py"

This commit is contained in:
Jenkins 2017-08-30 06:30:39 +00:00 committed by Gerrit Code Review
commit 88a642e3ff
2 changed files with 8 additions and 1 deletions

View File

@ -114,7 +114,10 @@ cinder_opts = [
cfg.BoolOpt('multiattach',
default=False,
help=_('Allow the volume to be attached to more than '
'one instance.'))
'one instance.')),
cfg.BoolOpt('all_tenants',
default=True,
help=_('Allow access over all tenants by provided auth'))
]
nova_group = cfg.OptGroup(

View File

@ -128,6 +128,8 @@ class Cinder(provider.Provider):
try:
search_opts = {'name': docker_volume_name,
'metadata': {consts.VOLUME_FROM: CONF.volume_from}}
if cinder_conf.all_tenants:
search_opts.update({'all_tenants': "true"})
vols = self.cinderclient.volumes.list(search_opts=search_opts)
except cinder_exception.ClientException as ex:
LOG.error("Error happened while getting volume list "
@ -408,6 +410,8 @@ class Cinder(provider.Provider):
docker_volumes = []
try:
search_opts = {'metadata': {consts.VOLUME_FROM: CONF.volume_from}}
if cinder_conf.all_tenants:
search_opts.update({'all_tenants': "true"})
for vol in self.cinderclient.volumes.list(search_opts=search_opts):
docker_volume_name = vol.name
if not docker_volume_name: