!32 [sync] PR-29: nfsserver: fix "server scope" functionality for both potentially other dropins AND multiple ExecStart
From: @openeuler-sync-bot Reviewed-by: @jxy_git Signed-off-by: @jxy_git
This commit is contained in:
commit
9809eff87b
57
nfsserver-fix-server-scope-functionality-for-both-po.patch
Normal file
57
nfsserver-fix-server-scope-functionality-for-both-po.patch
Normal file
@ -0,0 +1,57 @@
|
||||
From a346aae4bee8f53354fa001141057a1c88743ef3 Mon Sep 17 00:00:00 2001
|
||||
From: Lars Ellenberg <lars.ellenberg@linbit.com>
|
||||
Date: Tue, 26 Mar 2024 17:43:14 +0100
|
||||
Subject: [PATCH] nfsserver: fix "server scope" functionality for both
|
||||
potentially other dropins AND multiple ExecStart
|
||||
|
||||
986ebe18 (nfsserver: Fix NFSv4 lock failover: set NFS Server Scope (#1688), 2021-10-13)
|
||||
|
||||
Prefixes all `ExecStart=.*` with an unshare --uts.
|
||||
It did not expect an existing "empty, resetting" `ExecStart=`, though,
|
||||
and changed that as well. The attempt to fix that with
|
||||
|
||||
806e3fe9 (nfsserver: fix "server scope" functionality to live with additional drop-in files, 2023-02-15)
|
||||
|
||||
it wrong though: it only fixes the _last_ ExecStart found (`|tail -1`).
|
||||
There may be more than one ExecStart (even though arguable some of them should be ExecStartPost).
|
||||
|
||||
Without the "only last line", it would be a valid fix,
|
||||
though it would unnecessarily list irrelevant ExecStart lines as well.
|
||||
|
||||
My attempt to fix the fix:
|
||||
Find the set of `ExecStart=...` lines after the last reset (`ExecStart=`), if any.
|
||||
Edit in the "unshare uts" prefix into all of those lines.
|
||||
|
||||
(we could also patch only the line containing rpc.nfsd,
|
||||
but I'm sure some distro will find creative ways to break our assumptions again)
|
||||
---
|
||||
heartbeat/nfsserver | 13 +++++++++++--
|
||||
1 file changed, 11 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/heartbeat/nfsserver b/heartbeat/nfsserver
|
||||
index 8838195a..5793d7a7 100755
|
||||
--- a/heartbeat/nfsserver
|
||||
+++ b/heartbeat/nfsserver
|
||||
@@ -711,8 +711,17 @@ inject_unshare_uts_name_into_systemd_units ()
|
||||
test -d "$dir" || mkdir -p "$dir"
|
||||
test -e "$dropin" && rm -f "$dropin"
|
||||
|
||||
- # NOTE: additional ExecStart= might exist in the drop-in files, eg. openSUSE
|
||||
- edited_exec_start=$(systemctl cat $svc | sed -ne "s#^ExecStart=\\([-+:!@]*\\)\\(.\+\\)#ExecStart=\\1/usr/bin/unshare --uts /bin/sh -c 'hostname \${NFS_SERVER_SCOPE}; exec \"\$@\"' -- \\2#p" | tail -1)
|
||||
+ # NOTE: multiple ExecStart may exist,
|
||||
+ # even additional `ExecStart=` to reset the list might exist in the drop-in files.
|
||||
+ # We are interested in only the "currently relevant" set of ExecStart.
|
||||
+ local unshare_uts_set_hostname='/usr/bin/unshare --uts /bin/sh -c '\''hostname ${NFS_SERVER_SCOPE}; exec "$@"'\'' -- '
|
||||
+ edited_exec_start=$(systemctl cat $svc \
|
||||
+ | sed -n \
|
||||
+ -e '/^ExecStart=/ H;' \
|
||||
+ -e '/^ExecStart=[[:space:]]*$/ {s/.*//;h};' \
|
||||
+ -e '${g;s/^\n//;p}' \
|
||||
+ | sed -e 's#^\(ExecStart=[-+:!@]*\)\(.\+\)#\1'"$unshare_uts_set_hostname"'\2#'
|
||||
+ )
|
||||
|
||||
cat > "$dropin" <<___
|
||||
[Service]
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
Name: resource-agents
|
||||
Summary: Open Source HA Reusable Cluster Resource Scripts
|
||||
Version: 4.13.0
|
||||
Release: 12
|
||||
Release: 13
|
||||
License: GPLv2+ and LGPLv2+
|
||||
URL: https://github.com/ClusterLabs/resource-agents
|
||||
Source0: https://github.com/ClusterLabs/resource-agents/archive/v%{version}.tar.gz
|
||||
@ -17,6 +17,7 @@ Patch0008: Low-IPaddr2-Remove-stray-backslash.patch
|
||||
Patch0009: Doc-Delay-Drop-old-comments.patch
|
||||
Patch0010: portblock-accept-numeric-protocol-from-iptables.patch
|
||||
Patch0011: all-agents-remove-S-state-status-that-are-either-ign.patch
|
||||
Patch0012: nfsserver-fix-server-scope-functionality-for-both-po.patch
|
||||
Obsoletes: heartbeat-resources <= %{version}
|
||||
Provides: heartbeat-resources = %{version}
|
||||
BuildRequires: automake autoconf pkgconfig gcc perl-interpreter perl-generators python3-devel
|
||||
@ -114,6 +115,9 @@ export CFLAGS="$(echo '%{optflags}')"
|
||||
%{_mandir}/man8/{ocf-tester.8*,ldirectord.8*}
|
||||
|
||||
%changelog
|
||||
* Mon Apr 08 2024 zouzhimin <zouzhimin@kylinos.cn> - 4.13.0-13
|
||||
- nfsserver: fix "server scope" functionality for both potentially other dropins AND multiple ExecStart
|
||||
|
||||
* Fri Mar 29 2024 zouzhimin <zouzhimin@kylinos.cn> - 4.13.0-12
|
||||
- all agents: remove -S state/status that are either ignored
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user