diff mbox series

[ovs-dev] rhel/systemd: Change owner recursively and also on /etc/openvswitch.

Message ID 539f85b93f11f21dbb6bf561aafffc7a8e60f839.1742908495.git.tredaelli@redhat.com
State Accepted
Delegated to: aaron conole
Headers show
Series [ovs-dev] rhel/systemd: Change owner recursively and also on /etc/openvswitch. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/cirrus-robot success cirrus build: passed
ovsrobot/github-robot-_Build_and_Test success github build: passed

Commit Message

Timothy Redaelli March 25, 2025, 1:14 p.m. UTC
Since we use a floating user (user with dynamic userid) and floating
groups (groups with dynamic groupid), when you use bootc the uid/gid of
the directory may change and so it's necessary to be sure that the
uid/gid is updated each time you try to start the daemon.

ovsdb-server.service is the correct place to do that, since
ovs-vswitchd.service uses After=ovsdb-server.service and so it's always started
after it.

See https://github.com/bootc-dev/bootc/issues/673#issuecomment-2493912762

Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
---
 rhel/usr_lib_systemd_system_ovsdb-server.service | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Aaron Conole March 25, 2025, 3:30 p.m. UTC | #1
Timothy Redaelli via dev <ovs-dev@openvswitch.org> writes:

> Since we use a floating user (user with dynamic userid) and floating
> groups (groups with dynamic groupid), when you use bootc the uid/gid of
> the directory may change and so it's necessary to be sure that the
> uid/gid is updated each time you try to start the daemon.
>
> ovsdb-server.service is the correct place to do that, since
> ovs-vswitchd.service uses After=ovsdb-server.service and so it's always started
> after it.
>
> See https://github.com/bootc-dev/bootc/issues/673#issuecomment-2493912762
>
> Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
> ---

LGTM.

Acked-by: Aaron Conole <aconole@redhat.com>
Aaron Conole March 28, 2025, 5:38 p.m. UTC | #2
Timothy Redaelli via dev <ovs-dev@openvswitch.org> writes:

> Since we use a floating user (user with dynamic userid) and floating
> groups (groups with dynamic groupid), when you use bootc the uid/gid of
> the directory may change and so it's necessary to be sure that the
> uid/gid is updated each time you try to start the daemon.
>
> ovsdb-server.service is the correct place to do that, since
> ovs-vswitchd.service uses After=ovsdb-server.service and so it's always started
> after it.
>
> See https://github.com/bootc-dev/bootc/issues/673#issuecomment-2493912762
>
> Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
> ---

Thanks Timothy.  I've backported this down to branch-3.2 because it
seems like it could be needed for older revisions as well.
diff mbox series

Patch

diff --git a/rhel/usr_lib_systemd_system_ovsdb-server.service b/rhel/usr_lib_systemd_system_ovsdb-server.service
index 558632320..43ea3a570 100644
--- a/rhel/usr_lib_systemd_system_ovsdb-server.service
+++ b/rhel/usr_lib_systemd_system_ovsdb-server.service
@@ -18,7 +18,8 @@  EnvironmentFile=-/run/openvswitch.useropts
 # OVS_USER_ID from default.conf or sysconfig.
 ExecStartPre=/usr/bin/rm -f /run/openvswitch.useropts
 
-ExecStartPre=-/usr/bin/chown ${OVS_USER_ID} /run/openvswitch /var/log/openvswitch
+ExecStartPre=-/usr/bin/chown -R ${OVS_USER_ID} \
+             /etc/openvswitch /run/openvswitch /var/log/openvswitch
 ExecStartPre=/bin/sh -c '/usr/bin/echo "OVS_USER_ID=${OVS_USER_ID}" > /run/openvswitch.useropts'
 ExecStartPre=/bin/sh -c 'if [ "$${OVS_USER_ID/:*/}" != "root" ]; then /usr/bin/echo "OVS_USER_OPT=--ovs-user=${OVS_USER_ID}" >> /run/openvswitch.useropts; fi'
 ExecStart=/usr/share/openvswitch/scripts/ovs-ctl \