Fix bug 1763 - adding support for persistent volumes 44/11344/2
authorsousaedu <eduardo.sousa@canonical.com>
Thu, 11 Nov 2021 22:00:27 +0000 (22:00 +0000)
committersousaedu <eduardo.sousa@canonical.com>
Fri, 12 Nov 2021 00:09:05 +0000 (02:09 +0200)
Change-Id: I5691f7d7b1cc5b72e676c4181c94c9aee620cbd4
Signed-off-by: sousaedu <eduardo.sousa@canonical.com>
NG-RO/osm_ng_ro/ns.py

index 9841852..ee0463a 100644 (file)
@@ -877,6 +877,15 @@ class Ns(object):
                 if ssh_keys:
                     cloud_config["key-pairs"] = ssh_keys
 
+                disk_list = None
+                if target_vdu.get("virtual-storages"):
+                    disk_list = [
+                        {"size": disk["size-of-storage"]}
+                        for disk in target_vdu["virtual-storages"]
+                        if disk.get("type-of-storage")
+                        == "persistent-storage:persistent-storage"
+                    ]
+
                 extra_dict["params"] = {
                     "name": "{}-{}-{}-{}".format(
                         indata["name"][:16],
@@ -890,7 +899,7 @@ class Ns(object):
                     "flavor_id": "TASK-" + flavor_text,
                     "net_list": net_list,
                     "cloud_config": cloud_config or None,
-                    "disk_list": None,  # TODO
+                    "disk_list": disk_list,
                     "availability_zone_index": None,  # TODO
                     "availability_zone_list": None,  # TODO
                 }