From d43d07acbc06aa961f8a42a84cd2b59b5b683e1a Mon Sep 17 00:00:00 2001 From: Jerry Cai Date: Sat, 9 May 2015 15:10:24 +0800 Subject: [PATCH] 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 --- common-powervc/powervc/common/client/service.py | 4 ++++ common-powervc/powervc/common/constants.py | 1 + nova-powervc/powervc/nova/driver/virt/powervc/service.py | 4 +++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/common-powervc/powervc/common/client/service.py b/common-powervc/powervc/common/client/service.py index ae8da52..e97b201 100644 --- a/common-powervc/powervc/common/client/service.py +++ b/common-powervc/powervc/common/client/service.py @@ -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, diff --git a/common-powervc/powervc/common/constants.py b/common-powervc/powervc/common/constants.py index 972e94d..858c688 100644 --- a/common-powervc/powervc/common/constants.py +++ b/common-powervc/powervc/common/constants.py @@ -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') diff --git a/nova-powervc/powervc/nova/driver/virt/powervc/service.py b/nova-powervc/powervc/nova/driver/virt/powervc/service.py index 825921f..23cb053 100644 --- a/nova-powervc/powervc/nova/driver/virt/powervc/service.py +++ b/nova-powervc/powervc/nova/driver/virt/powervc/service.py @@ -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