From: yshah Date: Mon, 18 Nov 2024 07:41:35 +0000 (+0000) Subject: Adding new cluster update function X-Git-Tag: v17.0.0~23 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F38%2F14738%2F4;p=osm%2FLCM.git Adding new cluster update function Change-Id: I5733e7daf6189339836485f3d9d841f2647cad88 Signed-off-by: yshah --- diff --git a/osm_lcm/k8s.py b/osm_lcm/k8s.py index 55d98f47..51e04aef 100644 --- a/osm_lcm/k8s.py +++ b/osm_lcm/k8s.py @@ -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) diff --git a/osm_lcm/lcm.py b/osm_lcm/lcm.py index 89d877b6..fe937780 100644 --- a/osm_lcm/lcm.py +++ b/osm_lcm/lcm.py @@ -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"]}