SHA256
1
0
forked from pool/openvswitch

Accepting request 814738 from home:jaicaa:branches:network

- Fix preserving old default OVS_USER_ID for users that removed the
  override at /etc/sysconfig/openvswitch or for users affected by
  fillup bug below (bsc#1172861).
- Add patch to workaround a possible fillup issue that could cause
  existing openvswitch configuration to be unintendedly altered during
  upgrades (bsc#1172929).
  * 0001-Use-double-hash-for-OVS_USER_ID-comment.patch

OBS-URL: https://build.opensuse.org/request/show/814738
OBS-URL: https://build.opensuse.org/package/show/network/openvswitch?expand=0&rev=201
This commit is contained in:
Marcus Meissner 2020-06-22 11:21:05 +00:00 committed by Git OBS Bridge
parent 58308ffb2d
commit 933defe9f0
3 changed files with 71 additions and 7 deletions

View File

@ -0,0 +1,22 @@
From e007ba2d276530db6aa8a242b069f356395cd8e5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jaime=20Caama=C3=B1o=20Ruiz?= <jcaamano@suse.com>
Date: Mon, 15 Jun 2020 15:15:53 +0200
Subject: [PATCH] Use double hash for OVS_USER_ID comment
---
rhel/usr_share_openvswitch_scripts_systemd_sysconfig.template | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/rhel/usr_share_openvswitch_scripts_systemd_sysconfig.template b/rhel/usr_share_openvswitch_scripts_systemd_sysconfig.template
index c467d02db..10b841679 100644
--- a/rhel/usr_share_openvswitch_scripts_systemd_sysconfig.template
+++ b/rhel/usr_share_openvswitch_scripts_systemd_sysconfig.template
@@ -28,4 +28,4 @@
OPTIONS=""
# Uncomment and set the OVS User/Group value
-#OVS_USER_ID="openvswitch:openvswitch"
+## OVS_USER_ID="openvswitch:openvswitch"
--
2.26.1

View File

@ -1,3 +1,14 @@
-------------------------------------------------------------------
Mon Jun 15 13:21:22 UTC 2020 - Jaime Caamaño Ruiz <jcaamano@suse.com>
- Fix preserving old default OVS_USER_ID for users that removed the
override at /etc/sysconfig/openvswitch or for users affected by
fillup bug below (bsc#1172861).
- Add patch to workaround a possible fillup issue that could cause
existing openvswitch configuration to be unintendedly altered during
upgrades (bsc#1172929).
* 0001-Use-double-hash-for-OVS_USER_ID-comment.patch
------------------------------------------------------------------- -------------------------------------------------------------------
Wed Jun 3 14:53:21 UTC 2020 - Jaime Caamaño Ruiz <jcaamano@suse.com> Wed Jun 3 14:53:21 UTC 2020 - Jaime Caamaño Ruiz <jcaamano@suse.com>

View File

@ -68,6 +68,8 @@ Patch1: 0001-Run-openvswitch-as-openvswitch-openvswitch.patch
Patch2: 0001-Don-t-change-permissions-of-dev-hugepages.patch Patch2: 0001-Don-t-change-permissions-of-dev-hugepages.patch
# PATCH-FIX-UPSTREAM: 0001-rhel-Fix-reload-of-OVS_USER_ID-on-startup.patch # PATCH-FIX-UPSTREAM: 0001-rhel-Fix-reload-of-OVS_USER_ID-on-startup.patch
Patch3: 0001-rhel-Fix-reload-of-OVS_USER_ID-on-startup.patch Patch3: 0001-rhel-Fix-reload-of-OVS_USER_ID-on-startup.patch
# PATCH-FIX-OPENSUSE: 0001-Use-double-hash-for-OVS_USER_ID-comment.patch
Patch4: 0001-Use-double-hash-for-OVS_USER_ID-comment.patch
#OVN patches #OVN patches
# PATCH-FIX-OPENSUSE: 0001-Run-ovn-as-openvswitch-openvswitch.patch # PATCH-FIX-OPENSUSE: 0001-Run-ovn-as-openvswitch-openvswitch.patch
Patch20: 0001-Run-ovn-as-openvswitch-openvswitch.patch Patch20: 0001-Run-ovn-as-openvswitch-openvswitch.patch
@ -387,6 +389,7 @@ Devel libraries and headers for Open Virtual Network.
%patch1 -p1 %patch1 -p1
%patch2 -p1 %patch2 -p1
%patch3 -p1 %patch3 -p1
%patch4 -p1
cd %{ovn_dir} cd %{ovn_dir}
%patch20 -p1 %patch20 -p1
@ -825,19 +828,47 @@ if [ -e %{rpmstate}openvswitch ]; then
systemctl enable openvswitch.service systemctl enable openvswitch.service
fi fi
ovsdbdir_regex="^[[:space:]]*OVS_DBDIR[[:space:]]*="
ovsuserid_regex="^[[:space:]]*OVS_USER_ID[[:space:]]*="
ovsvar_valueregex="[^=]*=[[:space:]]*["'"'"']{0,1}([^"'"'"']*)["'"'"']{0,1}[[:space:]]*$"
conf="%{_sysconfdir}/sysconfig/openvswitch"
ovsdbdir=$(grep -E "${ovsdbdir_regex}" "${conf}" | tail -1 | sed -E --posix 's|'"${ovsvar_valueregex}"'|\1|')
ovsuserid=$(grep -E "${ovsuserid_regex}" "${conf}" | tail -1 | sed -E --posix 's|'"${ovsvar_valueregex}"'|\1|')
# Default DB path changed from /etc/openvswitch to /var/lib/openvswitch. # Default DB path changed from /etc/openvswitch to /var/lib/openvswitch.
# But try to keep the old path for upgraded users already making use of it. # But try to keep the old path for upgraded users already making use of it.
if [ -z "$ovsdbdir" ]; then
ovsdbpid=$(systemctl is-active --quiet ovsdb-server && systemctl show -p MainPID --value ovsdb-server || echo 0) ovsdbpid=$(systemctl is-active --quiet ovsdb-server && systemctl show -p MainPID --value ovsdb-server || echo 0)
if [ $ovsdbpid -gt 0 ] && [ -n "$(find /proc/$ovsdbpid/fd/ -type l -lname '%{_sysconfdir}/openvswitch/conf.db')" ]; then if [ $ovsdbpid -gt 0 ] && [ -n "$(find /proc/$ovsdbpid/fd/ -type l -lname '%{_sysconfdir}/openvswitch/conf.db')" ]; then
# We have ovsdb-server pid from the unit file with DB open at the old path. # We have ovsdb-server pid from the unit file with DB open at the old path.
# If we did not override OVS_DBDIR already, do it. ovsdbdir="%{_sysconfdir}/openvswitch"
if ! grep -qE "^OVS_DBDIR=" %{_sysconfdir}/sysconfig/openvswitch; then sed -i -e '1{r /dev/stdin' -e 'N}' "%{_sysconfdir}/sysconfig/openvswitch" << EOF
sed -i -e '1{r /dev/stdin' -e 'N}' %{_sysconfdir}/sysconfig/openvswitch << EOF
# OVS_DBDIR was automatically inserted here on openvswitch package upgrade to # OVS_DBDIR was automatically inserted here on openvswitch package upgrade to
# preserve the currently used /etc/openvswitch as the database directory. # preserve the currently used /etc/openvswitch as the database directory.
# Note that new installs use /var/lib/openvswitch as the default database # Note that new installs use /var/lib/openvswitch as the default database
# directory by omission. # directory by omission.
OVS_DBDIR=%{_sysconfdir}/openvswitch OVS_DBDIR="%{_sysconfdir}/openvswitch"
EOF
fi
fi
# Default OVS user changed from root:root to openvswitch:openvswitch.
# But try to keep root:root for upgraded users already making use of it.
# Use .conf.db.~lock~ instead of conf.db as conf.db might have been moved
# to a backup on a previous run attempt.
if [ -z "$ovsuserid" -a -n "$ovsdbdir" -a -f "$ovsdbdir/.conf.db.~lock~" ]; then
ovsuserid=$(stat -c "%U:%G" "$ovsdbdir/.conf.db.~lock~")
if [ "$ovsuserid" = "root:root" ]; then
sed -i -e '1{r /dev/stdin' -e 'N}' "%{_sysconfdir}/sysconfig/openvswitch" << EOF
# OVS_USER_ID was automatically inserted here on openvswitch package upgrade to
# preserve the currently used root:root as the openvswitch running credentials.
# Note that new installs use openvswitch:openvswitch as the default openvswitch
# running credentials by omission.
OVS_USER_ID="root:root"
EOF EOF
fi fi
fi fi