CESNET / netopeer2

NETCONF toolset
BSD 3-Clause "New" or "Revised" License
301 stars 189 forks source link

Confirmed commit not reverted on timeout when last operation was get #1371

Closed pfeige closed 1 year ago

pfeige commented 1 year ago

Hi Michal,

your solution for the rollback of a confirmed commit on timeout expiry seems to need a small extension. Consider the following command sequence - similar to the sysrepo issue#3014 but without the locking:

edit-config --target running     ### set test-string to RUNNING ###
edit-config --target candidate   ### set test-string to CANDIDATE ###
get-config --source running      ### test-string is RUNNING ###
get-config --source candidate    ### test-string is CANDIDATE ###
commit --confirmed --confirm-timeout 10
get   ### test-string is CANDIDATE ###
### wait 10 seconds ###
get-config --source running   ### test-string is CANDIDATE but should be RUNNING ###

The netopeer2 log shows the following output for each installed module:

[INF]: NP: Rolling back module "test-module"...
[ERR]: SR: Invalid arguments for function "sr_replace_config".
[ERR]: NP: Failed restoring backup for module "test-module".

It seems that the get operation sets the session datastore to SR_DS_OPERATIONAL and this is rejected in sr_replace_config() when the commit is rolled back. So, I guess this should be set to SR_DS_RUNNING or SR_DS_CANDIDATE before calling the mentioned function. What do you think?

BR, Peter

michalvasko commented 1 year ago

Of course, should have been there, I forgot it and it worked by chance. Thanks, should be fixed.

pfeige commented 1 year ago

OK - Thanks!