Using volume v2 client instead of v1 to get local volume

There is something wrong with volume v1 api to get volume detail info,
need to use volume v2 client instead of v1 to get local volume.

Change-Id: I76d067d2b1ee13c363dd5c22332d99d277c83f47
Closes-Bug: #1453358
This commit is contained in:
Jerry Cai 2015-05-09 15:10:24 +08:00
parent 6e2e506a7e
commit d43d07acbc
3 changed files with 8 additions and 1 deletions

View File

@ -396,6 +396,10 @@ class ClientServiceCatalog(object):
wrappers.append(CinderService(svc_type, version,
s_url, self.base_opts,
self.keystone))
elif svc_type == str(SERVICE_TYPES.volumev2):
wrappers.append(CinderService(svc_type, version,
s_url, self.base_opts,
self.keystone))
elif svc_type == str(SERVICE_TYPES.network):
wrappers.append(NeutronService(svc_type, version,
s_url, self.base_opts,

View File

@ -57,6 +57,7 @@ class ServiceTypes(object):
"""
def __init__(self):
self.volume = ServiceType('volume', 'cinder')
self.volumev2 = ServiceType('volumev2', 'cinder')
self.compute = ServiceType('compute', 'nova')
self.network = ServiceType('network', 'neutron')
self.identity = ServiceType('identity', 'keystone')

View File

@ -56,6 +56,8 @@ class PowerVCService(object):
from powervc.common.client import factory
self._cinderclient = factory.\
LOCAL.new_client(str(common_constants.SERVICE_TYPES.volume))
self._cinderclientv2 = factory.\
LOCAL.new_client(str(common_constants.SERVICE_TYPES.volumev2))
self._pvccinderclient = factory.\
POWERVC.new_client(str(common_constants.SERVICE_TYPES.volume))
self.max_tries = CONF.powervc.volume_max_try_times
@ -1042,7 +1044,7 @@ class PowerVCService(object):
"""
pvc_volume_id = ''
local_volume = self._cinderclient.volumes.get(local_id)
local_volume = self._cinderclientv2.volumes.get(local_id)
if local_volume is None:
return pvc_volume_id