Currently ovsdb-server creates and manages its own Unix domain
socket (/run/openvswitch/db.sock).  Services that depend on the
socket must declare explicit ordering and assertion guards
against the service.  If ovsdb-server restarts, the socket
disappears until the new process re-creates it.

With systemd socket activation, systemd owns the listening
socket and creates it before any service starts.  The socket
persists across ovsdb-server restarts, so clients queue
instead of getting connection-refused errors.  Dependent
services (ovs-vswitchd, ovs-delete-transient-ports) simply
Require the .socket unit, eliminating the need for
AssertPath* checks and simplifying dependency management.

Patch breakdown:

  1/5  Add a new "pfd:" (pre-opened file descriptor) passive
       stream class in lib/stream-unix.c, with documentation.
       For security, pfd: remotes are restricted to the command
       line only; runtime addition via ovsdb-server/add-remote
       or the database is rejected.

  2/5  Detect systemd socket activation in ovs-ctl via the
       LISTEN_PID/LISTEN_FDNAMES environment variables and
       pass --remote=pfd:3 instead of --remote=punix:$DB_SOCK.

  3/5  RHEL/Fedora: add ovsdb-server.socket unit and wire it
       into the existing service dependencies.

  4/5  Debian/Ubuntu: same for the Debian packaging.

  5/5  Tests: comprehensive test coverage for the pfd stream,
       including basic operation, JSON-RPC, invalid/non-socket/
       non-listening fd error paths, and runtime rejection via
       add-remote, string-column, and Manager table.

Timothy Redaelli (5):
  stream: Add "pfd:" passive stream for pre-opened file descriptors.
  ovs-ctl: Detect systemd socket activation.
  rhel: Add ovsdb-server.socket unit for systemd socket activation.
  debian: Add ovsdb-server.socket unit for systemd socket activation.
  tests: Add pfd stream tests.

 Documentation/ref/ovsdb.7.rst                 |  12 +
 debian/automake.mk                            |   1 +
 debian/openvswitch-switch.install             |   1 +
 .../openvswitch-switch.ovs-vswitchd.service   |   5 +-
 .../openvswitch-switch.ovsdb-server.service   |   1 +
 debian/openvswitch-switch.ovsdb-server.socket |  11 +
 lib/stream-provider.h                         |   1 +
 lib/stream-unix.c                             |  53 ++++
 lib/stream.c                                  |   5 +
 ovsdb/ovsdb-server.c                          |  23 +-
 rhel/automake.mk                              |   1 +
 rhel/openvswitch-fedora.spec.in               |   4 +
 ..._system_ovs-delete-transient-ports.service |   3 +-
 ...lib_systemd_system_ovs-vswitchd.service.in |   5 +-
 ...sr_lib_systemd_system_ovsdb-server.service |   1 +
 ...usr_lib_systemd_system_ovsdb-server.socket |  17 ++
 tests/automake.mk                             |   1 +
 tests/pfd-stream.at                           | 248 ++++++++++++++++++
 tests/testsuite.at                            |   1 +
 utilities/ovs-ctl.in                          |   8 +-
 20 files changed, 392 insertions(+), 10 deletions(-)
 create mode 100644 debian/openvswitch-switch.ovsdb-server.socket
 create mode 100644 rhel/usr_lib_systemd_system_ovsdb-server.socket
 create mode 100644 tests/pfd-stream.at

-- 
2.53.0

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to