[ovs-dev] [PATCH 00/15] Daemon mode for ovn-nbctl

Jakub Sitnicki jkbs at redhat.com
Wed Jul 11 19:27:02 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) and OVN test suite (tests/ovn.at) pass when
running ovn-nbctl as a daemon [1]. However, I'm still thinking how to nicely
integrate the daemon mode with the test suite so that the existing tests can be
run using either the normal or the daemon mode. Any ideas?

Also, not all places that call ctl_fatal() have been converted yet to propagate
the error to the caller. As a result hitting an unconverted an error path will
cause the daemon process to die. This can be worked around with the --monitor

Daemon mode should be considered experimental.

Changes RFC -> v1:

- Rebase onto master @ 61b1c7acb9a2 ("netdev-bsd: Fix crash on FreeBSD.").

- Add support for commands that use tabular output ('find' and 'list') thanks to
  recent work in table module by Ben Pfaff. This includes support for options
  that control table formatting.

- Run prerequisites routines. In the end this is needed to support the 'sync'
  command, which itself is more like an option than command (has to get
  processed before the commands run). This is also the reason for minor changes
  in the IDL.

- Add support for --dry-run, --wait / --no-wait, --timeout, and --oneline
  options. Timeout handling is different than in the normal mode - we only time
  out in poll_block(). Still, it serves the purpose avoiding an infinite 'sync'.

- Add tests for ovn-nbctl 'sync' command, dry-run mode, and oneline-formatted

- Extend the ovn-nbctl man-page with description of daemon mode.

- Remove extraneous return at the end of a void function. Pointed out by Ben

- Drop WIP patch for integration with tests from the series until a right
  approach can be found. Integration with tests that was used during development
  is available at:


- Minor style cleanups.


[1] Except test "2563: ovn -- IPv6 ND Router Solicitation responder" which seems
    broken in master @ 61b1c7acb9a2 ("netdev-bsd: Fix crash on FreeBSD.").

Jakub Sitnicki (15):
  table: Allow default style to be used in an assignment.
  ovsdb-idl: Allow monitoring columns that are already monitored.
  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: Propagate the error from do_nbctl().
  ovn-nbctl: Propagate errors from the main loop.
  ovn-nbctl: Propagate errors from prerequisites runner.
  ovn-nbctl: Introduce a poll_timer based wait timeout.
  ovn-nbctl: Extract helper for printing oneline output.
  ovn-nbctl: Initial support for daemon mode.
  tests: Add test for ovn-nbctl dry run mode.
  tests: Add test for sync command to ovn-nbctl test suite.
  tests: Add test for oneline-formatted output for ovn-nbctl.

 lib/ovsdb-idl.c               |  16 +-
 lib/table.h                   |   3 +-
 ovn/utilities/ovn-nbctl.8.xml |  40 +++++
 ovn/utilities/ovn-nbctl.c     | 368 ++++++++++++++++++++++++++++++++++--------
 tests/ovn-nbctl.at            |  42 +++++
 tests/ovn.at                  |  19 +++
 6 files changed, 423 insertions(+), 65 deletions(-)


More information about the dev mailing list