Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/debian/ovn-common.install b/debian/ovn-common.install
- index 91f7d206f..05c88f0ce 100644
- --- a/debian/ovn-common.install
- +++ b/debian/ovn-common.install
- @@ -14,6 +14,7 @@ usr/share/ovn/scripts/ovndb-servers.ocf
- usr/share/ovn/scripts/ovn-bugtool-nbctl-show
- usr/share/ovn/scripts/ovn-bugtool-sbctl-lflow-list
- usr/share/ovn/scripts/ovn-bugtool-sbctl-show
- +usr/lib/tmpfiles.d/ovn-tmpfiles.conf
- usr/share/man/man1/ovn-detrace.1
- usr/share/man/man5/ovn-ic-nb.5
- usr/share/man/man5/ovn-ic-sb.5
- diff --git a/debian/patches/avoid-recursive-chown-of-ovn-logdir.patch b/debian/patches/avoid-recursive-chown-of-ovn-logdir.patch
- new file mode 100644
- index 000000000..76cf0116b
- --- /dev/null
- +++ b/debian/patches/avoid-recursive-chown-of-ovn-logdir.patch
- @@ -0,0 +1,176 @@
- +Description: Manage OVN log ownership with tmpfiles.d.
- + ovn-ctl and ovn-lib currently chown the OVN log directory recursively
- + when services start. That can undo ownership set by distribution tooling
- + such as tmpfiles.d and logrotate. In particular, Debian and Ubuntu need
- + ovn-controller.log to remain root:adm so rsyslog can read it, but a later
- + OVN service restart may change it back to the OVN daemon user/group.
- + .
- + Add an OVN tmpfiles.d template for the log directory and
- + ovn-controller.log, with configurable log user, log group and tmpfiles.d
- + installation directory. Stop recursively changing the OVN log directory
- + ownership from ovn-ctl and ovn-lib at service startup.
- +Author: Zhang Hua <[email protected]>
- +Origin: upstream, https://github.com/ovn-org/ovn/commit/0c88c83b6d0ec2f62b8041061089ab8acfe31b5b
- +Bug: https://github.com/ovn-org/ovn/issues/310
- +Forwarded: not-needed
- +Last-Update: 2026-06-30
- +
- +diff --git a/Makefile.am b/Makefile.am
- +index 0f2389b25..79929ee6c 100644
- +--- a/Makefile.am
- ++++ b/Makefile.am
- +@@ -146,6 +146,7 @@ noinst_SCRIPTS =
- + OVSIDL_BUILT =
- + pkgdata_DATA =
- + sbin_SCRIPTS =
- ++tmpfiles_DATA =
- + scripts_SCRIPTS =
- + completion_SCRIPTS =
- + scripts_DATA =
- +@@ -163,6 +164,7 @@ endif
- + scriptsdir = $(pkgdatadir)/scripts
- + completiondir = $(sysconfdir)/bash_completion.d
- + pkgconfigdir = $(libdir)/pkgconfig
- ++tmpfilesdir = @TMPFILESDIR@
- +
- + # This ensures that files added to EXTRA_DIST are always distributed,
- + # even if they are inside an Automake if...endif conditional block that is
- +@@ -181,6 +183,8 @@ SUFFIXES += .in
- + sed \
- + -e 's,[@]PKIDIR[@],$(PKIDIR),g' \
- + -e 's,[@]LOGDIR[@],$(LOGDIR),g' \
- ++ -e 's,[@]LOGUSER[@],$(LOGUSER),g' \
- ++ -e 's,[@]LOGGROUP[@],$(LOGGROUP),g' \
- + -e 's,[@]DBDIR[@],$(DBDIR),g' \
- + -e 's,[@]PYTHON3[@],$(PYTHON3),g' \
- + -e 's,[@]OVN_RUNDIR[@],$(OVN_RUNDIR),g' \
- +diff --git a/configure.ac b/configure.ac
- +index 37e9e18f2..75978c409 100644
- +--- a/configure.ac
- ++++ b/configure.ac
- +@@ -91,6 +91,9 @@ OVS_CHECK_NETLINK
- + OVS_CHECK_LINUX_NETLINK
- + OVS_CHECK_OPENSSL
- + OVN_CHECK_LOGDIR
- ++OVN_CHECK_LOGUSER
- ++OVN_CHECK_LOGGROUP
- ++OVN_CHECK_TMPFILESDIR
- + OVN_CHECK_PYTHON3
- + OVN_CHECK_FLAKE8
- + OVN_CHECK_SPHINX
- +diff --git a/m4/ovn.m4 b/m4/ovn.m4
- +index f6e64545d..ea5081cc5 100644
- +--- a/m4/ovn.m4
- ++++ b/m4/ovn.m4
- +@@ -260,6 +260,37 @@ AC_DEFUN([OVN_CHECK_LOGDIR],
- + [LOGDIR='${localstatedir}/log/${PACKAGE}'])
- + AC_SUBST([LOGDIR])])
- +
- ++dnl Checks for the user that should own log files.
- ++AC_DEFUN([OVN_CHECK_LOGUSER],
- ++ [AC_ARG_WITH(
- ++ [log-user],
- ++ AS_HELP_STRING([--with-log-user=USER],
- ++ [user used for log files [[root]]]),
- ++ [LOGUSER=$withval],
- ++ [LOGUSER=root])
- ++ AC_SUBST([LOGUSER])])
- ++
- ++dnl Checks for the group that should own log files.
- ++AC_DEFUN([OVN_CHECK_LOGGROUP],
- ++ [AC_ARG_WITH(
- ++ [log-group],
- ++ AS_HELP_STRING([--with-log-group=GROUP],
- ++ [group used for log files [[root]]]),
- ++ [LOGGROUP=$withval],
- ++ [LOGGROUP=root])
- ++ AC_SUBST([LOGGROUP])])
- ++
- ++dnl Checks for the directory in which to install tmpfiles.d configuration.
- ++AC_DEFUN([OVN_CHECK_TMPFILESDIR],
- ++ [AC_ARG_WITH(
- ++ [tmpfilesdir],
- ++ AS_HELP_STRING([--with-tmpfilesdir=DIR],
- ++ [directory used for tmpfiles.d configuration
- ++ [[PREFIX/lib/tmpfiles.d]]]),
- ++ [TMPFILESDIR=$withval],
- ++ [TMPFILESDIR='${prefix}/lib/tmpfiles.d'])
- ++ AC_SUBST([TMPFILESDIR])])
- ++
- + dnl Checks for the directory in which to store the OVN database.
- + AC_DEFUN([OVN_CHECK_DBDIR],
- + [AC_ARG_WITH(
- +diff --git a/utilities/automake.mk b/utilities/automake.mk
- +index 579602920..21d49d3f7 100644
- +--- a/utilities/automake.mk
- ++++ b/utilities/automake.mk
- +@@ -26,6 +26,7 @@ EXTRA_DIST += \
- + utilities/ovn-ctl \
- + utilities/ovn-lib.in \
- + utilities/ovn-ctl.8.xml \
- ++ utilities/ovn-tmpfiles.conf.in \
- + utilities/ovn-docker-overlay-driver.in \
- + utilities/ovn-docker-underlay-driver.in \
- + utilities/ovn-nbctl.8.xml \
- +@@ -48,6 +49,7 @@ EXTRA_DIST += \
- + CLEANFILES += \
- + utilities/ovn-ctl.8 \
- + utilities/ovn-lib \
- ++ utilities/ovn-tmpfiles.conf \
- + utilities/ovn-docker-overlay-driver \
- + utilities/ovn-docker-underlay-driver \
- + utilities/ovn-nbctl.8 \
- +@@ -66,7 +68,9 @@ CLEANFILES += \
- + EXTRA_DIST += utilities/ovn-sim.in
- + noinst_SCRIPTS += utilities/ovn-sim
- +
- ++tmpfiles_DATA += utilities/ovn-tmpfiles.conf
- + utilities/ovn-lib: $(top_builddir)/config.status
- ++utilities/ovn-tmpfiles.conf: $(top_builddir)/config.status
- +
- + # ovn-nbctl
- + bin_PROGRAMS += utilities/ovn-nbctl
- +diff --git a/utilities/ovn-ctl b/utilities/ovn-ctl
- +index 2b33a25a1..15e5eaf82 100755
- +--- a/utilities/ovn-ctl
- ++++ b/utilities/ovn-ctl
- +@@ -276,9 +276,8 @@ $cluster_remote_port
- + upgrade_db "$file" "$schema"
- + fi
- +
- +- # Set the owner of the ovn_dbdir (with -R option) to OVN_USER if set.
- +- # This is required because the ovndbs are created with root permission
- +- # if not present when create_cluster/upgrade_db is called.
- ++ # Database files may be created as root before ovsdb-server drops
- ++ # privileges, so keep ownership aligned with OVN_USER when configured.
- + INSTALL_USER="$(id -un)"
- + INSTALL_GROUP="$(id -gn)"
- + [ "$OVN_USER" != "" ] && INSTALL_USER="${OVN_USER%:*}"
- +@@ -286,7 +285,6 @@ $cluster_remote_port
- +
- + chown -R $INSTALL_USER:$INSTALL_GROUP $ovn_dbdir
- + chown -R $INSTALL_USER:$INSTALL_GROUP $OVN_RUNDIR
- +- chown -R $INSTALL_USER:$INSTALL_GROUP $ovn_logdir
- + chown -R $INSTALL_USER:$INSTALL_GROUP $ovn_etcdir
- +
- + set ovsdb-server
- +diff --git a/utilities/ovn-lib.in b/utilities/ovn-lib.in
- +index f0f3dd2a7..ec5500d7b 100644
- +--- a/utilities/ovn-lib.in
- ++++ b/utilities/ovn-lib.in
- +@@ -133,7 +133,6 @@ start_ovn_daemon () {
- + set "$@" --detach
- + test X"$MONITOR" = Xno || set "$@" --monitor
- +
- +- chown -R $INSTALL_USER:$INSTALL_GROUP $ovn_logdir
- + chown -R $INSTALL_USER:$INSTALL_GROUP $ovn_rundir
- +
- + start_wrapped_daemon "$wrapper" $daemon "$priority" "$@"
- +diff --git a/utilities/ovn-tmpfiles.conf.in b/utilities/ovn-tmpfiles.conf.in
- +new file mode 100644
- +index 000000000..d37391f88
- +--- /dev/null
- ++++ b/utilities/ovn-tmpfiles.conf.in
- +@@ -0,0 +1,2 @@
- ++d @LOGDIR@ 0750 @LOGUSER@ @LOGGROUP@ -
- ++f @LOGDIR@/ovn-controller.log 0640 @LOGUSER@ @LOGGROUP@ -
- diff --git a/debian/patches/series b/debian/patches/series
- index a0b4d5671..400c6e5d9 100644
- --- a/debian/patches/series
- +++ b/debian/patches/series
- @@ -2,3 +2,4 @@ lp-2066194-tests-Ignore-ovs-vswitchd-received-packet-on-unknown.patch
- fix-nonascii-in-ovn-nb.xml.patch
- fix-ovn-vif-test-depends.patch
- lp-2147468-tests-Replace-unsupported-protocol-test.patch
- +avoid-recursive-chown-of-ovn-logdir.patch
- diff --git a/debian/rules b/debian/rules
- index d0b6de378..55ca23c7d 100755
- --- a/debian/rules
- +++ b/debian/rules
- @@ -25,6 +25,8 @@ override_dh_auto_configure:
- --sysconfdir=/etc \
- --with-dbdir=/var/lib/ovn \
- --with-ovs-source=$(CURDIR)/ovs \
- + --with-log-user=root \
- + --with-log-group=adm \
- --enable-ssl
- # Configure and build OVN VIF
- cd ovn-vif && \
- @@ -41,6 +43,8 @@ override_dh_auto_configure:
- --sysconfdir=/etc \
- --with-dbdir=/var/lib/ovn \
- --with-ovs-source=$(CURDIR)/ovs \
- + --with-log-user=root \
- + --with-log-group=adm \
- --enable-ssl \
- --with-vif-plug-provider=$(CURDIR)/ovn-vif
Advertisement
Add Comment
Please, Sign In to add comment