List all resources across different service

List all resources across different service by adding "all-tenant"
when call restAPI

Change-Id: Ie29e0bac6fa4c3fe4b771489a722b6712edc3a28
Closes-Bug: #1496781
This commit is contained in:
Jerry Cai 2015-09-17 18:05:06 +08:00
parent 8ff2c0d8e7
commit d0be0b27d7
3 changed files with 9 additions and 6 deletions

View File

@ -1241,9 +1241,9 @@ class PowerVCCinderManager(service.Service):
hostname = pvc_attachment.get('host_name')
pvc_instance_uuid = pvc_attachment.get('server_id')
local_instance_uuid = self._get_local_instance_id(pvc_instance_uuid)
values = {'server_id': local_instance_uuid,
'host_name': hostname,
'device': mountpoint}
values = {'instance_uuid': local_instance_uuid,
'attached_host': hostname,
'mountpoint': mountpoint}
db.volume_attachment_update(context, local_att_id, values)
def _start_periodic_volume_sync(self, context):
@ -1382,7 +1382,8 @@ class PowerVCCinderManager(service.Service):
# lazy import factory to avoid connect to env when load manager
from powervc.common.client import factory
novaclient = factory.LOCAL.get_client(str(SERVICE_TYPES.compute))
local_instances = novaclient.manager.list_all_servers()
local_instances = novaclient.manager.list_all_servers(
search_opts={'all_tenants': 1})
for inst in local_instances:
metadata = inst._info['metadata']
meta_pvc_id = None

View File

@ -194,7 +194,8 @@ class Client(neutron_client_bindings.Client):
if not self.nova:
self.nova = factory.LOCAL.get_client(str(SERVICE_TYPES.compute))
try:
local_instances = self.nova.manager.list_all_servers()
local_instances = self.nova.manager.list_all_servers(
search_opts={'all_tenants': 1})
except Exception as e:
LOG.exception(_("Exception occurred getting servers: %s"), e)
return vm_map

View File

@ -1291,7 +1291,8 @@ class PowerVCService(object):
Cache the volume data during the sync instances.
"""
cache_volume = {}
local_volumes = self._cinderclient.volumes.list_all_volumes()
local_volumes = self._cinderclient.volumes.list_all_volumes(
search_opts={'all_tenants': 1})
for local_volume in local_volumes:
metadata = getattr(local_volume, 'metadata', '')