Fix bug in healing on Azure 68/13968/1
authoraguilard <e.dah.tid@telefonica.com>
Thu, 5 Oct 2023 14:13:23 +0000 (14:13 +0000)
committeraguilard <e.dah.tid@telefonica.com>
Mon, 16 Oct 2023 13:35:23 +0000 (15:35 +0200)
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 <e.dah.tid@telefonica.com>
(cherry picked from commit 309b5bff8b1d25262c405b93e6362be39cbe0918)

RO-VIM-azure/osm_rovim_azure/vimconn_azure.py
releasenotes/notes/fix_healing-009e1ffa37c726a7.yaml [new file with mode: 0644]

index e964884..15c3cad 100755 (executable)
@@ -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 (file)
index 0000000..ce69f10
--- /dev/null
@@ -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.