Adding new cluster update function 38/14738/4
authoryshah <shahithya.y@tataelxsi.co.in>
Mon, 18 Nov 2024 07:41:35 +0000 (07:41 +0000)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Tue, 3 Dec 2024 11:27:18 +0000 (12:27 +0100)
Change-Id: I5733e7daf6189339836485f3d9d841f2647cad88
Signed-off-by: yshah <shahithya.y@tataelxsi.co.in>
osm_lcm/k8s.py
osm_lcm/lcm.py

index 55d98f4..51e04ae 100644 (file)
@@ -853,18 +853,21 @@ class ClusterLcm(GitOpsLcm):
             else:
                 db_cluster["resourceState"] = "ERROR"
 
+            db_cluster = self.update_operation_history(
+                db_cluster, workflow_status, resource_status
+            )
+
         db_cluster["operatingState"] = "IDLE"
-        db_cluster = self.update_operation_history(
-            db_cluster, workflow_status, resource_status
-        )
         # self.logger.info("db_cluster: {}".format(db_cluster))
         # TODO: verify enxtcondition
         # For the moment, if the workflow completed successfully, then we update the db accordingly.
         if workflow_status:
             if "k8s_version" in op_params:
                 db_cluster["k8s_version"] = op_params["k8s_version"]
-            elif "node_count" in op_params:
+            if "node_count" in op_params:
                 db_cluster["node_count"] = op_params["node_count"]
+            if "node_size" in op_params:
+                db_cluster["node_count"] = op_params["node_size"]
             # self.db.set_one(self.db_collection, {"_id": _id}, db_content)
         db_cluster["current_operation"] = None
         self.db.set_one("clusters", {"_id": db_cluster["_id"]}, db_cluster)
index 89d877b..fe93778 100644 (file)
@@ -863,7 +863,7 @@ class Lcm:
                     "cluster", cluster_id, cluster_id, "cluster_get_credentials", task
                 )
                 return
-            elif command == "upgrade" or command == "scale":
+            elif command == "upgrade" or command == "scale" or command == "update":
                 # db_vim = self.db.get_one("vim_accounts", {"_id": db_cluster["vim_account"]})
                 db_vim = self.db.get_one(
                     "vim_accounts", {"name": db_cluster["vim_account"]}