Restart restconf daemon only if restconf config is edited (not all)
This commit is contained in:
parent
e8cd587ded
commit
2ab90d847b
2 changed files with 14 additions and 9 deletions
|
|
@ -192,7 +192,7 @@ restconf_pseudo_process_commit(clicon_handle h,
|
|||
xtarget = transaction_target(td);
|
||||
if (xpath_first(xtarget, NULL, "/restconf[enable='true']") != NULL)
|
||||
enabled++;
|
||||
/* Toggle start/stop */
|
||||
/* Toggle start/stop if enable flag changed */
|
||||
if ((cx = xpath_first(xtarget, NULL, "/restconf/enable")) != NULL &&
|
||||
xml_flag(cx, XML_FLAG_CHANGE|XML_FLAG_ADD)){
|
||||
if (clixon_process_operation(h, RESTCONF_PROCESS,
|
||||
|
|
@ -203,6 +203,8 @@ restconf_pseudo_process_commit(clicon_handle h,
|
|||
if (transaction_dlen(xtarget) != 0 ||
|
||||
transaction_alen(xtarget) != 0 ||
|
||||
transaction_clen(xtarget) != 0){
|
||||
if ((cx = xpath_first(xtarget, NULL, "/restconf")) != NULL &&
|
||||
xml_flag(cx, XML_FLAG_CHANGE|XML_FLAG_ADD)){
|
||||
/* A restart can terminate a restconf connection (cut the tree limb you are sitting on)
|
||||
* Specifically, the socket is terminated where the reply is sent, which will
|
||||
* cause the curl to fail.
|
||||
|
|
@ -211,6 +213,7 @@ restconf_pseudo_process_commit(clicon_handle h,
|
|||
goto done;
|
||||
}
|
||||
}
|
||||
}
|
||||
retval = 0;
|
||||
done:
|
||||
return retval;
|
||||
|
|
|
|||
|
|
@ -431,6 +431,7 @@ static int
|
|||
clixon_process_operation_one(const proc_operation op,
|
||||
const char *netns,
|
||||
char **argv,
|
||||
const char *name,
|
||||
pid_t *pidp)
|
||||
{
|
||||
int retval = -1;
|
||||
|
|
@ -441,7 +442,8 @@ clixon_process_operation_one(const proc_operation op,
|
|||
goto done;
|
||||
if (op == PROC_OP_STOP || op == PROC_OP_RESTART){
|
||||
if (run){
|
||||
pidfile_zapold(*pidp); /* Ensures its dead */
|
||||
clicon_log(LOG_NOTICE, "Killing old daemon %s with pid: %d", name, *pidp);
|
||||
kill(*pidp, SIGTERM);
|
||||
}
|
||||
*pidp = 0; /* mark as dead */
|
||||
run = 0;
|
||||
|
|
@ -571,7 +573,7 @@ clixon_process_sched(int fd,
|
|||
pe = _proc_entry_list;
|
||||
do {
|
||||
if ((op = pe->pe_op) != PROC_OP_NONE){
|
||||
if (clixon_process_operation_one(op, pe->pe_netns, pe->pe_argv, &pe->pe_pid) < 0)
|
||||
if (clixon_process_operation_one(op, pe->pe_netns, pe->pe_argv, pe->pe_name, &pe->pe_pid) < 0)
|
||||
goto done;
|
||||
clicon_debug(1, "%s op:%s pid:%d", __FUNCTION__, clicon_int2str(proc_operation_map, op), pe->pe_pid);
|
||||
pe->pe_op = PROC_OP_NONE;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue