mbox series

[ovs-dev,v2,0/5] Add systemd socket activation for ovsdb-server

Message ID cover.1774960196.git.tredaelli@redhat.com
Headers show
Series Add systemd socket activation for ovsdb-server | expand

Message

Timothy Redaelli March 31, 2026, 12:34 p.m. UTC
Currently ovsdb-server creates its own Unix domain socket at
/run/openvswitch/db.sock, and dependent services need explicit
ordering and assertion checks to ensure the socket is available.

This series transfers socket ownership to systemd, which creates
the listening socket before any service starts.  The socket remains
available across service restarts, so clients queue instead of
getting connection failures.

Changes since v1:
  - stream: Use str_to_long() instead of strtol(); return EINVAL
    instead of ERANGE on invalid fd number (Aaron Conole).
  - ovs-ctl: Also unset LISTEN_PIDFDID when clearing socket
    activation environment variables (Aaron Conole).

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                             |  52 ++++
 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, 391 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

Comments

Aaron Conole April 10, 2026, 3:20 p.m. UTC | #1
Timothy Redaelli via dev <ovs-dev@openvswitch.org> writes:

> Currently ovsdb-server creates its own Unix domain socket at
> /run/openvswitch/db.sock, and dependent services need explicit
> ordering and assertion checks to ensure the socket is available.
>
> This series transfers socket ownership to systemd, which creates
> the listening socket before any service starts.  The socket remains
> available across service restarts, so clients queue instead of
> getting connection failures.

Applied.  Thanks, Timothy and Lubomir.

> Changes since v1:
>   - stream: Use str_to_long() instead of strtol(); return EINVAL
>     instead of ERANGE on invalid fd number (Aaron Conole).
>   - ovs-ctl: Also unset LISTEN_PIDFDID when clearing socket
>     activation environment variables (Aaron Conole).
>
> 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                             |  52 ++++
>  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, 391 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