[ovs-dev] [RFC PATCH 0/9] Daemon mode for ovn-nbctl

Jakub Sitnicki jkbs at redhat.com
Mon Jul 9 18:57:14 UTC 2018

This series extends ovn-nbctl tool with support for the daemon mode, where
ovn-nbctl acts a long-lived process that accepts commands over a UNIX socket.
The daemon can be started the same way as any other OVS/OVN server:

  ovn-nbctl --detach --pidfile --log-file

While commands can be issued to it using the 'ovs-appctl' tool:

  ovs-appctl -t ovn-nbctl run [OPTIONS] COMMAND [-- [OPTIONS] COMMAND] ...

(Although the goal is to control the daemon using the ovn-nbctl program itself.)

The motivation and the main benefit from the daemon mode is that the contents of
NB database have to be obtained only once, when the first command is ran. On big
databases (1000's of logical ports) this results in a speed up per command in
the range of 100's of milliseconds.

The changes are functional to the point that all test cases in the ovn-nbctl
test suite (tests/ovn-nbctl.at) pass. Except for "ovn-nbctl - connection" test
case (see limitations below). Last patch in the series demonstrates it.

The shortcomings of current implementation are:

 - No support for commands that use tabular output, that is 'find' or 'list'
   (used by the mentioned failing test case).  'table' module prints formatted
   tables contents to standard output so it cannot be easily reused on the
   server side.

 - '--dry-run', '--wait', '--timeout' are unsupported. Although these options
   are understood, they will either take no effect or cause the daemon to

 - Hitting an error path that calls ctl_fatal() to report an error will cause
   the daemon process to die. Use '--monitor' option as a workaround.

 - Documentation is missing.

Taking this into account, daemon mode should be considered experimental.

Very much looking forward to comments and feedback.


Jakub Sitnicki (9):
  ovn-nbctl: Extract the main loop.
  ovn-nbctl: Pull up destroying commands from do_nbctl().
  ovn-nbctl: Pull up releasing IDL from do_nbctl().
  ovn-nbctl: Signal need to try again via an output param.
  ovn-nbctl: Don't dup the error message just to report it.
  ovn-nbctl: Propagate the error from do_nbctl().
  ovn-nbctl: Propagate errors from the main loop.
  ovn-nbctl: Initial support for daemon mode.
  WIP: tests: Integrate with ovn-nctl daemon mode.

 ovn/utilities/ovn-nbctl.c | 259 ++++++++++++++++++++++++++++++++++++++--------
 tests/ovn-nbctl.at        |  31 +++++-
 2 files changed, 248 insertions(+), 42 deletions(-)


More information about the dev mailing list