From 0ece2f8e0ef0fb76b3d0f7b011dc645fbf52b9b6 Mon Sep 17 00:00:00 2001 From: Igor Soares Date: Wed, 31 May 2023 15:54:19 -0300 Subject: [PATCH] Add logs to inform when nodes are tainted Add logs to inform when the 'services=disabled:NoExecute' taint is added to nodes as well as when they are removed. This aims to improve future log analysis by facilitating the identification of cases where taints could be mistakenly added to nodes. Test Plan: PASS: lock controller and check if the operation is properly logged PASS: unlock controller and check if the operation is properly logged Partial-Bug: 2022008 Change-Id: Ie9c7432211621a9fbf7aa90282dfb91405f90c33 Signed-off-by: Igor Soares --- .../nfvi_plugins/nfvi_infrastructure_api.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/nfv/nfv-plugins/nfv_plugins/nfvi_plugins/nfvi_infrastructure_api.py b/nfv/nfv-plugins/nfv_plugins/nfvi_plugins/nfvi_infrastructure_api.py index 657782cd..98ebf036 100755 --- a/nfv/nfv-plugins/nfv_plugins/nfvi_plugins/nfvi_infrastructure_api.py +++ b/nfv/nfv-plugins/nfv_plugins/nfvi_plugins/nfvi_infrastructure_api.py @@ -2394,7 +2394,11 @@ class NFVIInfrastructureAPI(nfvi.api.v1.NFVIInfrastructureAPI): host_name, "NoExecute", "services") future.result = (yield) - if not future.result.is_complete(): + if future.result.is_complete(): + DLOG.info("Taint services=disabled:NoExecute successfully " + "removed from host, host_uuid=%s, host_name=%s." + % (host_uuid, host_name)) + else: DLOG.error("Kubernetes untaint_node failed, operation " "did not complete, host_uuid=%s, host_name=%s." % (host_uuid, host_name)) @@ -2437,7 +2441,11 @@ class NFVIInfrastructureAPI(nfvi.api.v1.NFVIInfrastructureAPI): future.result = (yield) - if not future.result.is_complete(): + if future.result.is_complete(): + DLOG.info("Taint services=disabled:NoExecute successfully " + "added to host, host_uuid=%s, host_name=%s." + % (host_uuid, host_name)) + else: DLOG.error("Kubernetes taint_node failed, operation " "did not complete, host_uuid=%s, host_name=%s." % (host_uuid, host_name))