From 5cf33858967f628088e7feae4ee652f910a7a7c2 Mon Sep 17 00:00:00 2001 From: Alexis Romero Date: Thu, 12 May 2022 13:23:25 +0200 Subject: [PATCH] Fixes bug 2026 : Persistent volumes to be created in the same AZ as the VM that will use them. Change-Id: I1f4161aa4f7b294e1acf2b33ba3208480f09eacc Signed-off-by: Alexis Romero --- .../osm_rovim_openstack/vimconn_openstack.py | 13 +++++++---- .../notes/fix_bug_2026-846d7383cdd4227e.yaml | 23 +++++++++++++++++++ 2 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 releasenotes/notes/fix_bug_2026-846d7383cdd4227e.yaml diff --git a/RO-VIM-openstack/osm_rovim_openstack/vimconn_openstack.py b/RO-VIM-openstack/osm_rovim_openstack/vimconn_openstack.py index 92e1f56a..dbd7c81b 100644 --- a/RO-VIM-openstack/osm_rovim_openstack/vimconn_openstack.py +++ b/RO-VIM-openstack/osm_rovim_openstack/vimconn_openstack.py @@ -1865,6 +1865,11 @@ class vimconnector(vimconn.VimConnector): # cloud config config_drive, userdata = self._create_user_data(cloud_config) + # get availability Zone + vm_av_zone = self._get_vm_availability_zone( + availability_zone_index, availability_zone_list + ) + # Create additional volumes in case these are present in disk_list base_disk_index = ord("b") boot_volume_id = None @@ -1882,12 +1887,16 @@ class vimconnector(vimconn.VimConnector): size=disk["size"], name=name + "_vd" + chr(base_disk_index), imageRef=disk["image_id"], + # Make sure volume is in the same AZ as the VM to be attached to + availability_zone=vm_av_zone, ) boot_volume_id = volume.id else: volume = self.cinder.volumes.create( size=disk["size"], name=name + "_vd" + chr(base_disk_index), + # Make sure volume is in the same AZ as the VM to be attached to + availability_zone=vm_av_zone, ) created_items["volume:" + str(volume.id)] = True @@ -1917,10 +1926,6 @@ class vimconnector(vimconn.VimConnector): ) if boot_volume_id: self.cinder.volumes.set_bootable(boot_volume_id, True) - # get availability Zone - vm_av_zone = self._get_vm_availability_zone( - availability_zone_index, availability_zone_list - ) # Manage affinity groups/server groups server_group_id = None diff --git a/releasenotes/notes/fix_bug_2026-846d7383cdd4227e.yaml b/releasenotes/notes/fix_bug_2026-846d7383cdd4227e.yaml new file mode 100644 index 00000000..b4e81b3b --- /dev/null +++ b/releasenotes/notes/fix_bug_2026-846d7383cdd4227e.yaml @@ -0,0 +1,23 @@ +####################################################################################### +# 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 for bug 2026: Availability Zone is not specified during persistent volume + creation. Updated RO-VIM-openstack/osm_rovim_openstack/vimconn_openstack.py + to use for the created volume the same Availability zone as the VM where it is + going to be attached. -- 2.25.1