Feature 10972: Support of volume multi-attach 47/13047/4
authorvegall <lvega@whitestack.com>
Mon, 6 Mar 2023 14:19:16 +0000 (14:19 +0000)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Mon, 29 May 2023 13:53:56 +0000 (15:53 +0200)
Change-Id: I5adb9d3847c8d11b152cadcf82e46d65de93c833
Signed-off-by: vegall <lvega@whitestack.com>
osm_lcm/ns.py

index 58d6475..9ceb609 100644 (file)
@@ -963,6 +963,10 @@ class NsLcm(LcmBase):
             image["vim_info"] = {}
         for flavor in target["flavor"]:
             flavor["vim_info"] = {}
+        if db_nsr.get("shared-volumes"):
+            target["shared-volumes"] = deepcopy(db_nsr["shared-volumes"])
+            for shared_volumes in target["shared-volumes"]:
+                shared_volumes["vim_info"] = {}
         if db_nsr.get("affinity-or-anti-affinity-group"):
             target["affinity-or-anti-affinity-group"] = deepcopy(
                 db_nsr["affinity-or-anti-affinity-group"]
@@ -1233,6 +1237,15 @@ class NsLcm(LcmBase):
                         if target_vim not in ns_ags["vim_info"]:
                             ns_ags["vim_info"][target_vim] = {}
 
+                # shared-volumes
+                if vdur.get("shared-volumes-id"):
+                    for sv_id in vdur["shared-volumes-id"]:
+                        ns_sv = find_in_list(
+                            target["shared-volumes"], lambda sv: sv_id in sv["id"]
+                        )
+                        if ns_sv:
+                            ns_sv["vim_info"][target_vim] = {}
+
                 vdur["vim_info"] = {target_vim: {}}
                 # instantiation parameters
                 if vnf_params: