2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-22 01:51:26 +00:00

rhel/systemd: Change owner recursively and also on /etc/openvswitch.

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

Acked-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
Signed-off-by: Aaron Conole <aconole@redhat.com>
This commit is contained in:
Timothy Redaelli 2025-03-25 14:14:55 +01:00 committed by Aaron Conole
parent f3036be659
commit 6403a49f3e

View File

@ -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 \