From 86f3a80e0bd34ccb18b1cc59197ca808f01c0cf2 Mon Sep 17 00:00:00 2001 From: aguilard Date: Thu, 5 Oct 2023 14:13:23 +0000 Subject: [PATCH] Fix bug in healing on Azure Healing operation doesn't work with VMs deployed on Azure due to lack of information in vnfrs requiered for the operation. That data must be provided by the 'refresh_vms_status' method in the connector. Change-Id: I915a0c7136e7a16729d0aba4357670dd28b66847 Signed-off-by: aguilard (cherry picked from commit 309b5bff8b1d25262c405b93e6362be39cbe0918) --- RO-VIM-azure/osm_rovim_azure/vimconn_azure.py | 20 +++++++++++++++- .../notes/fix_healing-009e1ffa37c726a7.yaml | 23 +++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/fix_healing-009e1ffa37c726a7.yaml diff --git a/RO-VIM-azure/osm_rovim_azure/vimconn_azure.py b/RO-VIM-azure/osm_rovim_azure/vimconn_azure.py index e9648849..15c3cadc 100755 --- a/RO-VIM-azure/osm_rovim_azure/vimconn_azure.py +++ b/RO-VIM-azure/osm_rovim_azure/vimconn_azure.py @@ -1782,7 +1782,21 @@ class vimconnector(vimconn.VimConnector): vm = self.conn_compute.virtual_machines.get( self.resource_group, res_name ) - out_vm["vim_info"] = str(vm) + img = vm.storage_profile.image_reference + images = self._get_version_image_list( + img.publisher, img.offer, img.sku, img.version + ) + vim_info = { + "id": vm.id, + "name": vm.name, + "location": vm.location, + "provisioning_state": vm.provisioning_state, + "vm_id": vm.vm_id, + "type": vm.type, + "flavor": {"id": vm.hardware_profile.vm_size}, + "image": images[0], + } + out_vm["vim_info"] = str(vim_info) out_vm["status"] = self.provision_state2osm.get( vm.provisioning_state, "OTHER" ) @@ -1862,6 +1876,10 @@ class vimconnector(vimconn.VimConnector): self.logger.debug("Public ip address is: %s", public_ip.ip_address) ips.append(public_ip.ip_address) + subnet = nic_data.ip_configurations[0].subnet.id + if subnet: + interface_dict["vim_net_id"] = subnet + private_ip = nic_data.ip_configurations[0].private_ip_address ips.append(private_ip) diff --git a/releasenotes/notes/fix_healing-009e1ffa37c726a7.yaml b/releasenotes/notes/fix_healing-009e1ffa37c726a7.yaml new file mode 100644 index 00000000..ce69f105 --- /dev/null +++ b/releasenotes/notes/fix_healing-009e1ffa37c726a7.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 a healing bug when a NS is deployed on Azure. + Healing operation doesn't work with VMs deployed on Azure due to lack of + information in vnfrs requiered for the operation. That data must be + provided by the 'refresh_vms_status' method in the connector. -- 2.25.1