From 778f3cc8c052bd17d0da32f07b880616d25f935a Mon Sep 17 00:00:00 2001 From: Lovejeet Singh Date: Mon, 13 Feb 2023 16:15:40 +0530 Subject: [PATCH] Bug 2202: Adding support for cinder V3 API with V2 API for persistent volumes. Change-Id: I7034564b91b94e6be242cb2ce0f4a5b147b87d64 Signed-off-by: Lovejeet Singh --- .../osm_rovim_openstack/vimconn_openstack.py | 21 +++++++++++++------ .../notes/fix_bug_2202-b30df4eda9acb214.yaml | 21 +++++++++++++++++++ 2 files changed, 36 insertions(+), 6 deletions(-) create mode 100644 releasenotes/notes/fix_bug_2202-b30df4eda9acb214.yaml diff --git a/RO-VIM-openstack/osm_rovim_openstack/vimconn_openstack.py b/RO-VIM-openstack/osm_rovim_openstack/vimconn_openstack.py index 9faf98d4..959839f6 100644 --- a/RO-VIM-openstack/osm_rovim_openstack/vimconn_openstack.py +++ b/RO-VIM-openstack/osm_rovim_openstack/vimconn_openstack.py @@ -355,12 +355,21 @@ class vimconnector(vimconn.VimConnector): endpoint_type=self.endpoint_type, region_name=region_name, ) - self.cinder = self.session["cinder"] = cClient.Client( - 2, - session=sess, - endpoint_type=self.endpoint_type, - region_name=region_name, - ) + + if sess.get_all_version_data(service_type="volumev2"): + self.cinder = self.session["cinder"] = cClient.Client( + 2, + session=sess, + endpoint_type=self.endpoint_type, + region_name=region_name, + ) + else: + self.cinder = self.session["cinder"] = cClient.Client( + 3, + session=sess, + endpoint_type=self.endpoint_type, + region_name=region_name, + ) try: self.my_tenant_id = self.session["my_tenant_id"] = sess.get_project_id() diff --git a/releasenotes/notes/fix_bug_2202-b30df4eda9acb214.yaml b/releasenotes/notes/fix_bug_2202-b30df4eda9acb214.yaml new file mode 100644 index 00000000..60b67e34 --- /dev/null +++ b/releasenotes/notes/fix_bug_2202-b30df4eda9acb214.yaml @@ -0,0 +1,21 @@ +####################################################################################### +# Copyright ETSI Contributors and Others. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +####################################################################################### +--- +fixes: + - | + Fix Bug 2202 Adding support for cinder V3 API with V2 API for persistent volumes + -- 2.17.1