]> git.proxmox.com Git - mirror_ovs.git/commitdiff
rhel: Fix reload of OVS_USER_ID on startup.
authorJaime Caamaño Ruiz <jcaamano@suse.com>
Tue, 12 May 2020 16:38:20 +0000 (18:38 +0200)
committerIlya Maximets <i.maximets@ovn.org>
Tue, 15 Sep 2020 20:47:08 +0000 (22:47 +0200)
OVS_USER_ID was being picked up from a previously existing
openvswitch.useropts rendering innefective any configuration change
through sysconfig.

There is no ordering between Exec* and Environment* stanzas of systemd,
full Enviroment* is always loaded before each Exec*. We make
sure that openvswitch.useropts is removed in a first Exec so that a
fresh OVS_USER_ID can be picked up from config in successive Exec*.

Fixes: 94e1e8b ("rhel: run ovn with the same user as ovs")
Signed-off-by: Jaime Caamaño Ruiz <jcaamano@suse.com>
Acked-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
rhel/usr_lib_systemd_system_ovsdb-server.service

index 4c170c09b48a9e0fb6cc87cf1fbba5d489a1aeac..98338b9dfbc9e9440d5ef2f1e3082eb1fde87f0d 100644 (file)
@@ -11,10 +11,16 @@ PIDFile=/var/run/openvswitch/ovsdb-server.pid
 Restart=on-failure
 EnvironmentFile=/etc/openvswitch/default.conf
 EnvironmentFile=-/etc/sysconfig/openvswitch
+EnvironmentFile=-/run/openvswitch.useropts
+
+# Environment is reloaded for each Exec*, make sure to
+# remove openvswitch.useropts first to reload a fresh
+# OVS_USER_ID from default.conf or sysconfig.
+ExecStartPre=/usr/bin/rm -f /run/openvswitch.useropts
+
 ExecStartPre=-/usr/bin/chown ${OVS_USER_ID} /var/run/openvswitch /var/log/openvswitch
-ExecStartPre=/bin/sh -c 'rm -f /run/openvswitch.useropts; /usr/bin/echo "OVS_USER_ID=${OVS_USER_ID}" > /run/openvswitch.useropts'
+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'
-EnvironmentFile=-/run/openvswitch.useropts
 ExecStart=/usr/share/openvswitch/scripts/ovs-ctl \
           --no-ovs-vswitchd --no-monitor --system-id=random \
           ${OVS_USER_OPT} \