diff --git a/fuxi/common/config.py b/fuxi/common/config.py index 2dc0960..0b39974 100644 --- a/fuxi/common/config.py +++ b/fuxi/common/config.py @@ -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( diff --git a/fuxi/volumeprovider/cinder.py b/fuxi/volumeprovider/cinder.py index 27c83a7..f010d99 100644 --- a/fuxi/volumeprovider/cinder.py +++ b/fuxi/volumeprovider/cinder.py @@ -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: