]> git.puffer.fish Git - matthieu/frr.git/commit
lib: remove expensive error handling in the northbound CLI client
authorRenato Westphal <renato@opensourcerouting.org>
Sun, 6 Oct 2019 00:20:28 +0000 (21:20 -0300)
committerRenato Westphal <renato@opensourcerouting.org>
Sat, 12 Oct 2019 00:18:36 +0000 (21:18 -0300)
commitc7c9103b01899d316372cc0272c37df9a7e59426
treebb55ae803cd92985adc361711bbd24babdcb719c
parentcaaa8b9c834dcf26292af67ebaaf154cac7cb8fe
lib: remove expensive error handling in the northbound CLI client

The nb_cli_apply_changes() function was creating a full copy of
the candidate configuration before editing it. This excerpt from
the northbond documentation explains why this was being done:
 "NOTE: the nb_cli_cfg_change() function clones the candidate
  configuration before actually editing it. This way, if any error
  happens during the editing, the original candidate is restored to
  avoid inconsistencies. Either all changes from the configuration
  command are performed successfully or none are. It's like a
  mini-transaction but happening on the candidate configuration
  (thus the northbound callbacks are not involved)".

The problem is that this kind of error handling is just too
expensive. A command should never fail to edit the candidate
configuration unless there's a bug in the code (e.g. when the
CLI wrapper command passes an integer value that YANG rejects due
to a "range" statement). In such cases, a command might fail to
be applied or applied only partially if it edits multiple YANG
nodes. When that happens, just log an error to make the operator
aware of the problem, but otherwise ignore it instead of rejecting
the command and restoring the candidate to its previous state. We
shouldn't add an extreme overhead to the northbound CLI client only
to handle errors that should never happen in practice.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
lib/northbound_cli.c