Skip to content

Commit

Permalink
[ctrmgrd] Fix the container restart during config reload
Browse files Browse the repository at this point in the history
Signed-off-by: Longxiang Lyu <lolv@microsoft.com>
  • Loading branch information
lolyu committed Jul 10, 2024
1 parent 1c35c62 commit 24f2149
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/sonic-ctrmgrd/ctrmgr/ctrmgrd.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,9 @@ def handle_update(self, feat, set_owner, ct_owner, remote_state):
service_restart = False

if set_owner == "local":
if ct_owner != "local":
# NOTE: no need to restart if the current owner is none,
# as none implies the container is not running,
if ct_owner != "local" and ct_owner != "none":
service_restart = True
else:
if (ct_owner != "none") and (remote_state == "pending"):
Expand Down
32 changes: 32 additions & 0 deletions src/sonic-ctrmgrd/tests/ctrmgrd_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,38 @@
}
}
}
},
5: {
common_test.DESCR: "No restart for current_owner == none in config reload",
common_test.ARGS: "ctrmgrd",
common_test.PRE: {
common_test.CONFIG_DB_NO: {
common_test.FEATURE_TABLE: {
"swss": {
"set_owner": "local",
"state": "enabled",
"auto_restart": "enabled"
}
}
}
},
common_test.UPD: {
common_test.STATE_DB_NO: {
common_test.FEATURE_TABLE: {
"swss": {
"system_state": "down",
"remote_state": "none",
"current_owner": "none",
"container_id": "",
"state": "enabled"
}
}
}
},
common_test.POST: {
common_test.STATE_DB_NO: {
}
}
}
}

Expand Down

0 comments on commit 24f2149

Please sign in to comment.