diff options
author | Christian Hopps <chopps@labn.net> | 2023-06-18 22:19:54 +0200 |
---|---|---|
committer | Christian Hopps <chopps@labn.net> | 2023-06-19 06:13:28 +0200 |
commit | df0173ceeb93572329b04f1bfc5a8925e60513e3 (patch) | |
tree | 6b48aab9aafa50b106ffb7fa0aecd952dd0915b7 /vtysh | |
parent | mgmtd: simplify locking, removing read locks (diff) | |
download | frr-df0173ceeb93572329b04f1bfc5a8925e60513e3.tar.xz frr-df0173ceeb93572329b04f1bfc5a8925e60513e3.zip |
mgmtd: KISS the locking code
Move away from things like "lock if not locked" type code, require the
user has locked prior to geting to that point.
For now we warn if we are taking a lock we already had; however, this
should really be a failure point.
New requirements:
SETCFG -
not implicit commit - requires user has locked candidate DS and they
must unlock after
implicit commit - requires user has locked candidate and running DS
both locks will be unlocked on reply to the SETCFG
COMMITCFG -
requires user has locked candidate and running DS and they must unlock
after
rollback - this code now get both locks and then does an unlock and
early return thing on the adapter side. It needs to be un-special
cased in follow up work that would also include tests for this
functionality.
Signed-off-by: Christian Hopps <chopps@labn.net>
Diffstat (limited to 'vtysh')
-rw-r--r-- | vtysh/vtysh.c | 5 | ||||
-rw-r--r-- | vtysh/vtysh_config.c | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index c94b47fef..ee52a98ad 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -2333,8 +2333,9 @@ DEFUNSH(VTYSH_REALLYALL, vtysh_disable, vtysh_disable_cmd, "disable", } DEFUNSH(VTYSH_REALLYALL, vtysh_config_terminal, vtysh_config_terminal_cmd, - "configure [terminal]", + "configure [terminal [file-lock]]", "Configuration from vty interface\n" + "Configuration with locked datastores\n" "Configuration terminal\n") { vty->node = CONFIG_NODE; @@ -2355,7 +2356,7 @@ static int vtysh_exit(struct vty *vty) if (vty->node == CONFIG_NODE) { /* resync in case one of the daemons is somewhere else */ vtysh_execute("end"); - vtysh_execute("configure"); + vtysh_execute("configure terminal file-lock"); } return CMD_SUCCESS; } diff --git a/vtysh/vtysh_config.c b/vtysh/vtysh_config.c index 2949faa42..a5f790bbc 100644 --- a/vtysh/vtysh_config.c +++ b/vtysh/vtysh_config.c @@ -607,7 +607,7 @@ static int vtysh_read_file(FILE *confp, bool dry_run) vty->node = CONFIG_NODE; vtysh_execute_no_pager("enable"); - vtysh_execute_no_pager("configure terminal"); + vtysh_execute_no_pager("configure terminal file-lock"); if (!dry_run) vtysh_execute_no_pager("XFRR_start_configuration"); |