X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=NG-RO%2Fosm_ng_ro%2Fns_thread.py;h=767382d99ee0f4c0cf007f585dedae53543cb859;hb=refs%2Fchanges%2F06%2F12006%2F2;hp=617f58bb8d70db21063ca8c7c068bb1022875198;hpb=8658c2cd33bcea66c9b99aabb0825071c5c42df0;p=osm%2FRO.git diff --git a/NG-RO/osm_ng_ro/ns_thread.py b/NG-RO/osm_ng_ro/ns_thread.py index 617f58bb..767382d9 100644 --- a/NG-RO/osm_ng_ro/ns_thread.py +++ b/NG-RO/osm_ng_ro/ns_thread.py @@ -391,6 +391,11 @@ class VimInteractionVdu(VimInteractionBase): vim_vm_id, created_items = target_vim.new_vminstance(**params_copy) interfaces = [iface["vim_id"] for iface in params_copy["net_list"]] + # add to created items previous_created_volumes (healing) + if task.get("previous_created_volumes"): + for k, v in task["previous_created_volumes"].items(): + created_items[k] = v + ro_vim_item_update = { "vim_id": vim_vm_id, "vim_status": "BUILD", @@ -400,6 +405,7 @@ class VimInteractionVdu(VimInteractionBase): "vim_message": None, "interfaces_vim_ids": interfaces, "interfaces": [], + "interfaces_backup": [], } self.logger.debug( "task={} {} new-vm={} created={}".format( @@ -2410,6 +2416,7 @@ class NsWorker(threading.Thread): "vim_name", "vim_status", "interfaces", + "interfaces_backup", ) } @@ -2463,6 +2470,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(