Adds 'all_tenants' search option in volumeprovider/cinder.py
When user create a docker volume with a pre-created cinder volume, user can't see the docker volume if the pre-created cinder volume's tenant is diffent to the tenant Fuxi use. This patch adds 'all_tenants' option configurable. With this, user can search cinder volumes over all tenant. Change-Id: I0519f54c07e7ac84f53b580a34b3b4064183d8a6 Closes-Bug: #1656960
This commit is contained in:
parent
e6fa465eae
commit
e7740fb3a7
|
@ -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(
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue