-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix conflict in mgmtd on startup #15286
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -616,8 +616,13 @@ static int vtysh_read_file(FILE *confp, bool dry_run) | |
vty->node = CONFIG_NODE; | ||
|
||
vtysh_execute_no_pager("enable"); | ||
vtysh_execute_no_pager("conf term file-lock"); | ||
vty->vtysh_file_locked = true; | ||
/* | ||
* When reading the config, we need to wait until the lock is acquired. | ||
* If we ignore the failure and continue without the lock, the config | ||
* will be fully ignored. | ||
*/ | ||
while (vtysh_execute_no_pager("conf term file-lock") == CMD_WARNING_CONFIG_FAILED) | ||
choppsv1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
usleep(100000); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it possible that vtysh will never get the lock? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not during the startup. After the startup, it is possible if someone uses |
||
|
||
if (!dry_run) | ||
vtysh_execute_no_pager("XFRR_start_configuration"); | ||
|
@@ -629,7 +634,6 @@ static int vtysh_read_file(FILE *confp, bool dry_run) | |
vtysh_execute_no_pager("XFRR_end_configuration"); | ||
|
||
vtysh_execute_no_pager("end"); | ||
vty->vtysh_file_locked = false; | ||
vtysh_execute_no_pager("disable"); | ||
|
||
vty_close(vty); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should make
file-lock
a hidden command, and just leave theconfigure [terminal]
public.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using
file-lock
is not only needed for config reading, but it's also the way to work with FRR in explicit-commit mode instead of implicit-commit-after-every-command mode. However, there are two problems:file-lock
naming is confusing and doesn't explain that it enables explicit-commit modeSo maybe you're right and we should hide it until all daemons are converted to mgmtd. But also there's an option to rename
file-lock
to something likelocked
orwith-commit
and leave it not hidden.Anyway, it's not really related to this fix, so can be changed in a separate PR.