Bug 2124 fixed: timeout defined when calling the N2VC scale method 01/12401/4
authorPedro Escaleira <escaleira@av.it.pt>
Sat, 23 Jul 2022 22:16:06 +0000 (23:16 +0100)
committercubag <gcuba@whitestack.com>
Fri, 11 Nov 2022 18:54:55 +0000 (19:54 +0100)
Change-Id: I45b55c0a402b29bf3bc5d09a80eb4e5da850480c
Signed-off-by: Pedro Escaleira <escaleira@av.it.pt>
osm_lcm/ns.py

index 6a764f0..6306687 100644 (file)
@@ -121,14 +121,16 @@ __author__ = "Alfonso Tierno <alfonso.tiernosepulveda@telefonica.com>"
 
 
 class NsLcm(LcmBase):
-    timeout_vca_on_error = (
+    timeout_scale_on_error = (
         5 * 60
     )  # Time for charm from first time at blocked,error status to mark as failed
+    timeout_scale_on_error_outer_factor = 1.05  # Factor in relation to timeout_scale_on_error related to the timeout to be applied within the asyncio.wait_for coroutine
     timeout_ns_deploy = 2 * 3600  # default global timeout for deployment a ns
     timeout_ns_terminate = 1800  # default global timeout for un deployment a ns
     timeout_ns_heal = 1800  # default global timeout for un deployment a ns
     timeout_charm_delete = 10 * 60
-    timeout_primitive = 30 * 60  # timeout for primitive execution
+    timeout_primitive = 30 * 60  # Timeout for primitive execution
+    timeout_primitive_outer_factor = 1.05  # Factor in relation to timeout_primitive related to the timeout to be applied within the asyncio.wait_for coroutine
     timeout_ns_update = 30 * 60  # timeout for ns update
     timeout_progress_primitive = (
         10 * 60
@@ -7193,23 +7195,27 @@ class NsLcm(LcmBase):
                                     primitive_name=terminate_config_primitive["name"],
                                     params=primitive_params_,
                                     db_dict=db_dict,
+                                    total_timeout=self.timeout_primitive,
                                     vca_id=vca_id,
                                 ),
-                                timeout=600,
+                                timeout=self.timeout_primitive
+                                * self.timeout_primitive_outer_factor,
                             )
 
                 await asyncio.wait_for(
                     self.k8scluster_map[k8s_cluster_type].scale(
-                        kdu_instance,
-                        scale,
-                        kdu_scaling_info["resource-name"],
+                        kdu_instance=kdu_instance,
+                        scale=scale,
+                        resource_name=kdu_scaling_info["resource-name"],
+                        total_timeout=self.timeout_scale_on_error,
                         vca_id=vca_id,
                         cluster_uuid=cluster_uuid,
                         kdu_model=kdu_model,
                         atomic=True,
                         db_dict=db_dict,
                     ),
-                    timeout=self.timeout_vca_on_error,
+                    timeout=self.timeout_scale_on_error
+                    * self.timeout_scale_on_error_outer_factor,
                 )
 
                 if kdu_scaling_info["type"] == "create":