Fix Bug 2041: Backup VDU interfaces for healing features 25/12125/5
authoraticig <gulsum.atici@canonical.com>
Wed, 25 May 2022 00:12:36 +0000 (03:12 +0300)
committeraticig <gulsum.atici@canonical.com>
Mon, 30 May 2022 08:12:32 +0000 (10:12 +0200)
If a VDU is manually deleted in Openstack, the RO overwrites the
interfaces as an empty list. However, healing features (10909 and 10923) need the
interfaces information to heal the VDU again. This fix backups the interfaces of
VDU under interfaces_backup keyword.

Change-Id: I17ea28c2c4f486d0bbecdcbc5005413222bfeed9
Signed-off-by: aticig <gulsum.atici@canonical.com>
NG-RO/osm_ng_ro/ns_thread.py
releasenotes/notes/fixing_bug_2041-9ccceeeff8008094.yaml [new file with mode: 0644]

index 617f58b..fda7253 100644 (file)
@@ -400,6 +400,7 @@ class VimInteractionVdu(VimInteractionBase):
                 "vim_message": None,
                 "interfaces_vim_ids": interfaces,
                 "interfaces": [],
+                "interfaces_backup": [],
             }
             self.logger.debug(
                 "task={} {} new-vm={} created={}".format(
@@ -2410,6 +2411,7 @@ class NsWorker(threading.Thread):
                     "vim_name",
                     "vim_status",
                     "interfaces",
+                    "interfaces_backup",
                 )
             }
 
@@ -2463,6 +2465,21 @@ class NsWorker(threading.Thread):
                             ).split(";")[0]
 
             self.db.set_one(table, q_filter={"_id": _id}, update_dict=update_dict)
+
+            # If interfaces exists, it backups VDU interfaces in the DB for healing operations
+            if ro_vim_item_update.get("interfaces"):
+                search_key = path_vim_status + ".interfaces"
+                if update_dict.get(search_key):
+                    interfaces_backup_update = {
+                        path_vim_status + ".interfaces_backup": update_dict[search_key]
+                    }
+
+                    self.db.set_one(
+                        table,
+                        q_filter={"_id": _id},
+                        update_dict=interfaces_backup_update,
+                    )
+
         else:
             update_dict = {path_item + ".status": "DELETED"}
             self.db.set_one(
diff --git a/releasenotes/notes/fixing_bug_2041-9ccceeeff8008094.yaml b/releasenotes/notes/fixing_bug_2041-9ccceeeff8008094.yaml
new file mode 100644 (file)
index 0000000..92cd786
--- /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:
+  - |
+    Fixing Bug 2041: If a VDU is manually deleted in Openstack, the RO overwrites the
+    interfaces as an empty list. However, healing features (10909 and 10923) need the
+    interfaces information to heal the vdu again. This fix backups the interfaces of
+    VDU under interfaces_backup keyword.