From 2831313330a850fdfefd5fab5273e8d850a50e03 Mon Sep 17 00:00:00 2001 From: kuanyu_chen Date: Wed, 25 May 2022 15:02:54 +0800 Subject: [PATCH] Fix ctrmgrd occasionally restart service problem * Originally, the container script will set the current_owner to none when it try to stop that feature. Later, when the container script want to start the feature, it will set local/kube as the owner and then start it. However, the ctrmgrd.py will do the same thing for the feature. It will try to restart the feature when the owner changed from none to local. The function of ctrmgrd is duplicate of the container script. * Prevent the ctrmgrd.py from restarting the feature when the owner is changed from none to local. --- src/sonic-ctrmgrd/ctrmgr/ctrmgrd.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/sonic-ctrmgrd/ctrmgr/ctrmgrd.py b/src/sonic-ctrmgrd/ctrmgr/ctrmgrd.py index 84c23f9f0eb..752c8ce82df 100755 --- a/src/sonic-ctrmgrd/ctrmgr/ctrmgrd.py +++ b/src/sonic-ctrmgrd/ctrmgr/ctrmgrd.py @@ -519,7 +519,10 @@ def handle_update(self, feat, set_owner, ct_owner, remote_state): service_restart = False if set_owner == "local": - if ct_owner != "local": + # none is a default value for current_owner when docker stop. + # It is not necessary to restart the feature again when the system + # config a new value for it. The container script will handle it. + if (ct_owner != "local") and (ct_owner != "none"): service_restart = True else: if (ct_owner != "none") and (remote_state == "pending"):