- drbd: Support and adaptations for OCF 1.1 standard (bsc#1233273)

OBS-URL: https://build.opensuse.org/package/show/network:ha-clustering:Factory/drbd-utils?expand=0&rev=140
This commit is contained in:
heming zhao 2024-11-12 13:46:58 +00:00 committed by Git OBS Bridge
commit 31d1049584
22 changed files with 4610 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.osc

View File

@ -0,0 +1,35 @@
From e64b8b13435f99ba21a74caeebeb996f76dfd43c Mon Sep 17 00:00:00 2001
From: Joel Colledge <joel.colledge@linbit.com>
Date: Wed, 26 Jul 2023 10:14:54 +0200
Subject: [PATCH] drbdadm,v9: do not segfault when re-configuring proxy with no
path
This prevents a segfault when a resource has a connection with no path,
and "adjust" attempts to re-configure proxy.
This could occur as follows, when drbd-proxy-ctl is not on $PATH:
* Bring resource and connection up without proxy.
* Add proxy configuration to res file.
* "drbdadm adjust <res>" - this causes the existing path to be deleted,
but no new path is created because drbd-proxy-ctl cannot be executed.
* "drbdadm adjust <res>" - segfault.
---
user/v9/drbdadm_adjust.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/user/v9/drbdadm_adjust.c b/user/v9/drbdadm_adjust.c
index 83df624c4e46..f3d321b9ec65 100644
--- a/user/v9/drbdadm_adjust.c
+++ b/user/v9/drbdadm_adjust.c
@@ -390,7 +390,7 @@ static int proxy_reconf(const struct cfg_ctx *ctx, struct connection *running_co
goto redo_whole_conn;
running_path = STAILQ_FIRST(&running_conn->paths); /* multiple paths via proxy, later! */
- if (!running_path->my_proxy)
+ if (!running_path || !running_path->my_proxy)
goto redo_whole_conn;
if (running_path->proxy_conn_is_down)
--
2.35.3

View File

@ -0,0 +1,45 @@
From feebd378195cf18b06f9fa209586af0c6d32ddb8 Mon Sep 17 00:00:00 2001
From: Sam James <sam@gentoo.org>
Date: Thu, 27 Jul 2023 06:30:25 +0100
Subject: [PATCH] user: drbrdmon: add missing <stdint.h> includes
GCC 13 drops some transitive includes within libstdc++.
Explicitly include <stdint.h> for uint32_t etc.
Note that using <stdint.h> deliberately because we're not using std::-prefixed
types.
Signed-off-by: Sam James <sam@gentoo.org>
---
user/drbdmon/DrbdMonConsts.h | 1 +
user/drbdmon/terminal/DisplayId.h | 1 +
2 files changed, 2 insertions(+)
diff --git a/user/drbdmon/DrbdMonConsts.h b/user/drbdmon/DrbdMonConsts.h
index 73d25f28fbeb..f962d0d38a6d 100644
--- a/user/drbdmon/DrbdMonConsts.h
+++ b/user/drbdmon/DrbdMonConsts.h
@@ -1,6 +1,7 @@
#ifndef DRBDMONCONSTS_H
#define DRBDMONCONSTS_H
+#include <stdint.h>
#include <string>
class DrbdMonConsts
diff --git a/user/drbdmon/terminal/DisplayId.h b/user/drbdmon/terminal/DisplayId.h
index 40d3de488fd9..fa4b744438d4 100644
--- a/user/drbdmon/terminal/DisplayId.h
+++ b/user/drbdmon/terminal/DisplayId.h
@@ -1,6 +1,7 @@
#ifndef DISPLAYID_H
#define DISPLAYID_H
+#include <stdint.h>
#include <string>
class DisplayId
--
2.35.3

File diff suppressed because it is too large Load Diff

23
_service Normal file
View File

@ -0,0 +1,23 @@
<services>
<service name="tar_scm" mode="disabled">
<param name="url">https://github.com/LINBIT/drbd-utils.git</param>
<param name="scm">git</param>
<param name="filename">drbd-utils</param>
<!--
build service using release drbd-utils atm.
<param name="version">9.19.0</param>
Using release tarball instead of git since need buildtag.c/h
-->
<param name="versionformat">9.19.0+git.%h</param>
<param name="revision">master</param>
</service>
<service name="recompress" mode="disabled">
<param name="file">*drbd-utils*.tar</param>
<param name="compression">gz</param>
</service>
<service name="set_version" mode="disabled">
<param name="basename">drbd-utils</param>
</service>
</services>

View File

@ -0,0 +1,11 @@
diff -Naur drbd-utils-9.0.0+git.98b6340c.orig/scripts/global_common.conf drbd-utils-9.0.0+git.98b6340c/scripts/global_common.conf
--- drbd-utils-9.0.0+git.98b6340c.orig/scripts/global_common.conf 2017-06-07 16:04:14.063680274 +0800
+++ drbd-utils-9.0.0+git.98b6340c/scripts/global_common.conf 2017-06-07 16:04:45.519644428 +0800
@@ -42,6 +42,7 @@
# RECOMMENDED for three or more storage nodes with DRBD 9:
# quorum majority;
+ quorum off;
# on-no-quorum suspend-io | io-error;
}

View File

@ -0,0 +1,64 @@
From 6d5cb4c97031f28ae70406145aa437b3107246e6 Mon Sep 17 00:00:00 2001
From: Su Yue <glass.su@suse.com>
Date: Sun, 3 Mar 2024 16:36:54 +0800
Subject: [PATCH 1/2] crm-fence-peer.9.sh: fix parsing in_ccm crmd fields of
node_state with Pacemaker 2.1.7
If pacemaker version < 2.1.7, in_ccm of node_state is "true" or "false"
and crmd is "online" or "offline".
pacemaker 2.1.7 changed the two fields into timestamps.
For in_ccm, the value is timestamp since when node has been a cluster
member("true"). A value 0 of means the node is not a cluster member("false").
For crmd, the value is timestamp since when peer has been online in
CPG("online"). A value 0 means the peer is offline in CPG("offline").
The original code doesn't handle these fields in timestamp format.
Since there are many comprare of strings in context, converting in_ccm and crmd
from timestamps/0 to old strings is simpler and clearer.
Link: https://github.com/ClusterLabs/pacemaker/blob/Pacemaker-2.1.7/lib/pengine/unpack.c#L1581
Signed-off-by: Su Yue <glass.su@suse.com>
---
scripts/crm-fence-peer.9.sh | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/scripts/crm-fence-peer.9.sh b/scripts/crm-fence-peer.9.sh
index 44da6516bf3f..a3353a7354a6 100755
--- a/scripts/crm-fence-peer.9.sh
+++ b/scripts/crm-fence-peer.9.sh
@@ -888,6 +888,31 @@ guess_if_pacemaker_will_fence()
esac
done
+ # Copied from pacemaker-2.1.7:lib/pengine/unpack.c:
+ # Since crm_feature_set 3.18.0 (pacemaker-2.1.7):
+ #
+ # - in_ccm ::= <timestamp>|0
+ # Since when node has been a cluster member. A value 0 of means the
+ # node is not a cluster member.
+ # - crmd ::= <timestamp>|0
+ # Since when peer has been online in CPG. A value 0 means the peer
+ # is offline in CPG.
+ if [[ $in_ccm =~ ^[0-9]+$ ]]; then
+ if [[ $in_ccm = "0" ]]; then
+ in_ccm="false"
+ else
+ in_ccm="true"
+ fi
+ fi
+
+ if [[ $crmd =~ ^[0-9]+$ ]]; then
+ if [[ $crmd = "0" ]]; then
+ crmd="offline"
+ else
+ crmd="online"
+ fi
+ fi
+
# if it is not enabled, no point in waiting for it.
if ! $stonith_enabled ; then
# "normalize" the rest of the logic
--
2.44.0

View File

@ -0,0 +1,30 @@
From 922e6702cb7a089102f4843b2994ef0749c41573 Mon Sep 17 00:00:00 2001
From: Su Yue <glass.su@suse.com>
Date: Sun, 3 Mar 2024 16:56:38 +0800
Subject: [PATCH 2/2] crm-fence-peer.9.sh: use join of node_state to judge
whether node is banned
crmd in node_state can't be "banned". join should be used instead
of crmd.
Signed-off-by: Su Yue <glass.su@suse.com>
---
scripts/crm-fence-peer.9.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/crm-fence-peer.9.sh b/scripts/crm-fence-peer.9.sh
index a3353a7354a6..b326a1656c15 100755
--- a/scripts/crm-fence-peer.9.sh
+++ b/scripts/crm-fence-peer.9.sh
@@ -934,7 +934,7 @@ guess_if_pacemaker_will_fence()
# for further inspiration, see pacemaker:lib/pengine/unpack.c, determine_online_status_fencing()
[[ -z $in_ccm ]] && will_fence=true
- [[ $crmd = "banned" ]] && will_fence=true
+ [[ $join = "banned" ]] && will_fence=true
if [[ ${expected-down} = "down" && $in_ccm = "false" && $crmd != "online" ]]; then
: "pacemaker considers this as clean down"
elif [[ $in_ccm = false ]] || [[ $crmd != "online" ]]; then
--
2.44.0

View File

@ -0,0 +1,74 @@
From a1fbba9b5b5cd41eb8623ede4e7f89b0f65602c8 Mon Sep 17 00:00:00 2001
From: Su Yue <glass.su@suse.com>
Date: Sun, 7 Jul 2024 15:22:49 +0800
Subject: [PATCH 1/3] drbd.ocf: replace crm_master with ocf_promotion_score
The crm_master command has been deprecated and replaced with a new
crm_attribute --promotion option that defaults to --lifetime=reboot
(example: crm_master -l reboot -v 10 becomes
crm_attribute --promotion -v 10. The old command will still work for
now, but the new one should be used if available. The new option is
available as of CRM feature set 3.9.0).
Also define ocf_promotion_score() as
resource-agents/heartbeat/ocf-shellfuncs.in if it doesn't exist.
Signed-off-by: Su Yue <glass.su@suse.com>
---
scripts/drbd.ocf | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/scripts/drbd.ocf b/scripts/drbd.ocf
index 1d051baa550d..133aff737455 100755
--- a/scripts/drbd.ocf
+++ b/scripts/drbd.ocf
@@ -104,6 +104,18 @@ if ! command -v ocf_is_true &> /dev/null ; then
}
fi
+if ! command -v ocf_promotion_score &> /dev/null ; then
+ ocf_promotion_score() {
+ ocf_version_cmp "$OCF_RESKEY_crm_feature_set" "3.10.0"
+ res=$?
+ if [ $res -eq 2 ] || [ $res -eq 1 ] || ! have_binary "crm_master"; then
+ ${HA_SBIN_DIR}/crm_attribute -p ${OCF_RESOURCE_INSTANCE} $@
+ else
+ ${HA_SBIN_DIR}/crm_master -l reboot $@
+ fi
+ }
+fi
+
# Defaults
OCF_RESKEY_drbdconf_default="/etc/drbd.conf"
OCF_RESKEY_unfence_extra_args_default="--quiet --flock-required --flock-timeout 0 --unfence-only-if-owner-match"
@@ -570,9 +582,9 @@ do_drbdadm() {
unset current_master_score
get_current_master_score()
{
- # only call crm_master once
+ # only call get crm master once
[[ ${current_master_score+set} ]] ||
- current_master_score=$(crm_master -q -l reboot -G 2>/dev/null)
+ current_master_score=$(ocf_promotion_score -q -G 2>/dev/null)
# return value of this function:
# true if master_score is present
# false if master_score is not present
@@ -585,13 +597,13 @@ set_master_score() {
if [[ $1 -le 0 ]]; then
remove_master_score
else
- do_cmd ${HA_SBIN_DIR}/crm_master -Q -l reboot -v $1 &&
+ do_cmd ocf_promotion_score -Q -v $1 &&
current_master_score=$1
fi
}
remove_master_score() {
- do_cmd ${HA_SBIN_DIR}/crm_master -l reboot -D
+ do_cmd ocf_promotion_score -D
current_master_score=""
}
--
2.45.2

View File

@ -0,0 +1,78 @@
From 3baaf88af512492dd5315a50cf421fbcf51ef9b8 Mon Sep 17 00:00:00 2001
From: Su Yue <glass.su@suse.com>
Date: Sun, 7 Jul 2024 16:52:18 +0800
Subject: [PATCH 3/3] drbd.ocf: update for OCF 1.1
According to [1], the commit
1. bumps drbd ocf version to 1.5
2. updates the <version> element to 1.1 for declare support OCF 1.1.
3. uses unique-group attribute but keeps deprecated unique attribute.
4. advertises new role names 'Unpromoted' and 'Unpromoted' instead of
'Master' and 'Slave'.
Because of change[4], the drbd ocf RA won't be able to support old
names so we need to bump version of the RA.
Links: https://projects.clusterlabs.org/w/development/update_resource_agent_for_ocf_1.1/
Signed-off-by: Su Yue <glass.su@suse.com>
---
scripts/drbd.ocf | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/scripts/drbd.ocf b/scripts/drbd.ocf
index bbe25f38edda..5b213640ec38 100755
--- a/scripts/drbd.ocf
+++ b/scripts/drbd.ocf
@@ -233,13 +233,13 @@ meta_data() {
<?xml version="1.0"?>
<!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
<!-- version attribute is version of this resource agent -->
-<resource-agent name="drbd" version="LINBIT 1.4">
+<resource-agent name="drbd" version="LINBIT 1.5">
<!-- Version number of the standard this agent complies with -->
-<version>1.0</version>
+<version>1.1</version>
<longdesc lang="en">
-This resource agent manages a DRBD resource as a master/slave resource.
+This resource agent manages a DRBD resource as a promotable resource.
DRBD is a shared-nothing replicated storage device.
NOTE:
@@ -253,10 +253,10 @@ See the DRBD User's Guide for more information.
https://docs.linbit.com/
</longdesc>
-<shortdesc lang="en">Manages a DRBD device as a Master/Slave resource</shortdesc>
+<shortdesc lang="en">Manages a DRBD device as a promotable resource</shortdesc>
<parameters>
-<parameter name="drbd_resource" unique="1" required="1">
+<parameter name="drbd_resource" unique="1" unique-group="name" required="1">
<longdesc lang="en">
The name of the drbd resource from the drbd.conf file.
</longdesc>
@@ -483,8 +483,8 @@ to be generated after the failover of a "healthy" DRBD.
<action name="demote" timeout="90" />
<action name="notify" timeout="90" />
<action name="stop" timeout="100" />
-<action name="monitor" timeout="20" interval="20" role="Slave" />
-<action name="monitor" timeout="20" interval="10" role="Master" />
+<action name="monitor" timeout="20" interval="20" role="Unpromoted" />
+<action name="monitor" timeout="20" interval="10" role="Promoted" />
<action name="meta-data" timeout="5" />
<action name="validate-all" />
</actions>
@@ -974,7 +974,7 @@ drbd_monitor() {
fi
case $status in
- (0) : "OCF_SUCCESS aka 'running/slave'" ;;
+ (0) : "OCF_SUCCESS aka 'running/unpromotable'" ;;
(1) : "OCF_ERR_GENERIC" ;;
(2) : "OCF_ERR_ARGS" ;;
(3) : "OCF_ERR_UNIMPLEMENTED" ;;
--
2.45.2

View File

@ -0,0 +1,35 @@
From 4efed473e70c91487f7834f8bf536970e9389f3f Mon Sep 17 00:00:00 2001
From: Su Yue <glass.su@suse.com>
Date: Sun, 7 Jul 2024 16:05:42 +0800
Subject: [PATCH 2/3] drbd.ocf: update regex of sed for new output from
crm_resource
Since Pacemaker-2.1.0
crm_resource --resource "$OCF_RESOURCE_INSTANCE" --locate outputs
'resource promotable-clone is running on: cluster02 Promoted'
was
'resource promotable-clone is running on: cluster02 Master'.
So update the regular expression.
Signed-off-by: Su Yue <glass.su@suse.com>
---
scripts/drbd.ocf | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/drbd.ocf b/scripts/drbd.ocf
index 133aff737455..bbe25f38edda 100755
--- a/scripts/drbd.ocf
+++ b/scripts/drbd.ocf
@@ -999,7 +999,7 @@ crm_resource_locate_master()
called_crm_resource_locate=true
DRBD_PRIMARY_PEER_according_to_pcmk=$(
crm_resource --resource "$OCF_RESOURCE_INSTANCE" --locate 2>/dev/null |
- sed -ne 's/^.*is running on: \([^ ]*\) Master.*$/\1/p' |
+ sed -ne 's/^.*is running on: \([^ ]*\) \(Master\|Promoted\).*$/\1/p' |
grep -vix -m1 -e "$HOSTNAME")
}
--
2.45.2

BIN
drbd-utils-9.25.0.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

2032
drbd-utils.changes Normal file

File diff suppressed because it is too large Load Diff

1
drbd-utils.rpmlintrc Normal file
View File

@ -0,0 +1 @@
addFilter("missing-call-to-setgroups-before-setuid /usr/sbin/drbdmon")

242
drbd-utils.spec Normal file
View File

@ -0,0 +1,242 @@
#
# spec file for package drbd-utils
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define services drbd.service drbd-lvchange@.service drbd-promote@.service drbd-demote-or-escalate@.service drbd-reconfigure-suspend-or-error@.service drbd-services@.target drbd-wait-promotable@.service drbd@.service drbd@.target ocf.ra@.service
%if 0%{?suse_version} < 1550
# for SLEs
%define sbindir /sbin
# see bsc#1203220 & usrmerge_move_lib_to_prefix_lib.patch for %{libdir}
%define libdir /usr/lib
%else
# for opensuse
%define sbindir %{_sbindir}
%define libdir %{_prefix}/lib
%endif
%bcond_without drbdmon
# Man pages are included in the released tarball.
# Only need po4a to build man from git source code
%bcond_without prebuiltman
Name: drbd-utils
Version: 9.25.0
Release: 0
Summary: Distributed Replicated Block Device
License: GPL-2.0-or-later
Group: Productivity/Clustering/HA
URL: https://linbit.com/linbit-software-download-page-for-linstor-and-drbd-linux-driver/
Source: https://pkg.linbit.com//downloads/drbd/utils/%{name}-%{version}.tar.gz
Source100: %{name}.rpmlintrc
#############################################
# Upstream patches
Patch0001: 0001-drbdadm-v9-do-not-segfault-when-re-configuring-proxy.patch
Patch0002: 0002-user-drbrdmon-add-missing-stdint.h-includes.patch
Patch0003: 0003-Introduce-default_types.h-header.patch
# SUSE specific patches
Patch1001: init-script-fixes.diff
Patch1002: usrmerge_move_lib_to_prefix_lib.patch
Patch1003: fence-after-pacemaker-down.patch
Patch1004: bsc-1032142_Disable-quorum-in-default-configuration.patch
Patch1005: move_fencing_from_disk_to_net_in_example.patch
Patch1006: pie-fix.patch
Patch1007: bsc-1219263_crm-fence-peer.9.sh-fix-parsing-in_ccm-crmd-fields-o.patch
Patch1008: bsc-1219263_crm-fence-peer.9.sh-use-join-of-node_state-to-judge-.patch
Patch1009: bsc-1233273_drbd.ocf-replace-crm_master-with-ocf_promotion_score.patch
Patch1010: bsc-1233273_drbd.ocf-update-regex-of-sed-for-new-output-from-crm.patch
Patch1011: bsc-1233273_drbd.ocf-update-for-OCF-1.1.patch
Patch1099: rpmlint-build-error.patch
#############################################
Provides: drbd-bash-completion = %{version}
Provides: drbd-pacemaker = %{version}
Provides: drbd-udev = %{version}
Obsoletes: drbd-bash-completion < %{version}
Obsoletes: drbd-pacemaker < %{version}
Obsoletes: drbd-udev < %{version}
# drbd-utils first split from drbd-8.4.5(only driver)
# and suse let drbd driver goes in-kernel
# Provides: drbd = 8.4.5
# Obsoletes: drbd < 8.4.5
%ifarch %{ix86} x86_64
Provides: drbd-xen = %{version}
Obsoletes: drbd-xen < %{version}
%endif
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: bison
BuildRequires: docbook-xsl-stylesheets
BuildRequires: flex
BuildRequires: gcc
BuildRequires: glibc-devel
BuildRequires: libxslt
BuildRequires: make
BuildRequires: pkgconfig
BuildRequires: pkgconfig(systemd)
BuildRequires: pkgconfig(udev)
%if %{with drbdmon}
BuildRequires: gcc-c++
%endif
%if %{without prebuiltman}
BuildRequires: po4a
%endif
Provides: drbd-control
Provides: drbdsetup
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
Drbd is a distributed replicated block device. It mirrors a block
device over the network to another machine. Think of it as networked
raid 1. It is a building block for setting up clusters.
%prep
%autosetup -p1
%build
export WANT_DRBD_REPRODUCIBLE_BUILD=1
./autogen.sh
PATH=/sbin:$PATH ./configure \
--with-udev \
--with-distro=suse \
--without-heartbeat \
--with-pacemaker \
--with-xen \
--with-bashcompletion \
--with-initscripttype=systemd \
--with-systemdunitdir=%{_prefix}/lib/systemd/system \
%if 0%{?suse_version} < 1550
--sbindir=/sbin \
%else
--sbindir=%{_sbindir} \
%endif
--prefix=%{_prefix} \
--localstatedir=%{_localstatedir} \
--mandir=%{_mandir} \
--sysconfdir=%{_sysconfdir} \
--datarootdir=%{_datadir} \
--datadir=%{_datadir} \
--libdir=%{_prefix}/lib \
--exec_prefix=%{_prefix}/lib \
%{?with_drbdmon: --with-drbdmon} \
%{?with_prebuiltman: --with-prebuiltman} \
--with-tmpfilesdir=%{_tmpfilesdir} \
--without-83support \
--without-84support
%make_build OPTFLAGS="%{optflags}"
%install
%make_install
%ifnarch %{ix86} x86_64
rm -rf %{buildroot}%{_sysconfdir}/xen
%endif
rm -rf %{buildroot}%{libdir}/drbd/crm-*fence-peer.sh # bsc#1204276
%pre
%service_add_pre %{services}
%post
%tmpfiles_create %{_tmpfilesdir}/drbd.conf
%service_add_post %{services}
#May also overlap the $MAN_LINK in documentation/v9/Makefile.in
for f in drbd drbdadm drbdmeta drbdsetup; do
ln -sf $f-9.0.8.gz %{_mandir}/man8/$f.8.gz
ln -sf $f-9.0.8.gz %{_mandir}/ja/man8/$f.8.gz
done
ln -sf drbd.conf-9.0.5.gz %{_mandir}/man5/drbd.conf.5.gz
ln -sf drbd.conf-9.0.5.gz %{_mandir}/ja/man5/drbd.conf.5.gz
%if %{with drbdmon}
ln -sf drbdmon-9.0.8.gz %{_mandir}/man8/drbdmon.8.gz
ln -sf drbdmon-9.0.8.gz %{_mandir}/ja/man8/drbdmon.8.gz
%endif
%preun
%service_del_preun %{services}
%postun
%service_del_postun %{services}
%if 0%{?suse_version} < 1550
if [ -d /lib/drbd ]; then
rm -rf /lib/drbd.rpmmoved
mv /lib/drbd /lib/drbd.rpmmoved
elif [ ! -e %{libdir}/drbd ] && [ -L /lib/drbd ]; then
rm /lib/drbd
fi
%endif
%posttrans
%if 0%{?suse_version} < 1550
if [ ! -e /lib/drbd ]; then
ln -sf %{libdir}/drbd /lib/drbd
fi
%endif
%files -n drbd-utils
%config(noreplace) %{_sysconfdir}/drbd.conf
%config(noreplace) %{_sysconfdir}/drbd.d/global_common.conf
%config(noreplace) %{_sysconfdir}/multipath/conf.d/drbd.conf
%{_datadir}/bash-completion/completions/drbdadm
%{_tmpfilesdir}/drbd.conf
%{_mandir}/man5/drbd.*
%{_mandir}/man8/drbd*
%{_mandir}/man7/ocf*
%{_mandir}/man7/drbd*
%{_mandir}/ja/man5/drbd.*
%{_mandir}/ja/man8/drbd*
%license COPYING
%doc README.md
%doc ChangeLog
%doc scripts/drbd.conf.example
%dir %{_sysconfdir}/drbd.d
%dir %{_sysconfdir}/multipath
%dir %{_sysconfdir}/multipath/conf.d
%{libdir}/drbd
%{sbindir}/drbdadm
%{sbindir}/drbdsetup
%{sbindir}/drbdmeta
%if %{with drbdmon}
%{sbindir}/drbdmon
%endif
%ifarch %{ix86} x86_64
%dir %attr(700,root,root) %{_sysconfdir}/xen
%dir %{_sysconfdir}/xen/scripts
%attr(755,root,root) %{_sysconfdir}/xen/scripts/block-drbd
%endif
%{_prefix}/lib/ocf/resource.d/linbit/drbd
%{_prefix}/lib/ocf/resource.d/linbit/drbd-attr
%{_prefix}/lib/ocf/resource.d/linbit/drbd.shellfuncs.sh
%{_udevrulesdir}/65-drbd.rules
%{_unitdir}/drbd.service
%{_unitdir}/drbd-lvchange@.service
%{_unitdir}/drbd-promote@.service
%{_unitdir}/drbd-demote-or-escalate@.service
%{_unitdir}/drbd-reconfigure-suspend-or-error@.service
%{_unitdir}/drbd-services@.target
%{_unitdir}/drbd-wait-promotable@.service
%{_unitdir}/drbd@.service
%{_unitdir}/drbd@.target
%{_unitdir}/ocf.ra@.service
%dir %{_prefix}/lib/ocf
%dir %{_prefix}/lib/ocf/resource.d
%dir %{_prefix}/lib/ocf/resource.d/linbit
%dir %{_localstatedir}/lib/drbd
%changelog

View File

@ -0,0 +1,29 @@
diff -Naur drbd-utils-8.9.6.orig/scripts/crm-fence-peer.sh drbd-utils-8.9.6/scripts/crm-fence-peer.sh
--- drbd-utils-8.9.6.orig/scripts/crm-fence-peer.sh 2016-03-14 15:54:38.701360775 +0800
+++ drbd-utils-8.9.6/scripts/crm-fence-peer.sh 2016-03-14 16:00:06.333338664 +0800
@@ -531,6 +531,25 @@
[[ $crmd = "banned" ]] && will_fence=true
if [[ ${expected-down} = "down" && $in_ccm = "false" && $crmd != "online" ]]; then
: "pacemaker considers this as clean down"
+ elif [[ $crmd/$join/$expected = "offline/down/down" ]] ; then
+ # Check if pacemaker is simply shutdown, but membership/quorum is
+ # possibly still established (corosync2/cman)
+ # 1.1.11 will set expected="down" on a clean shutdown too
+ # Look for "shutdown" transient node attribute
+ local node_attributes=$(set +x; echo "$cib_xml" |
+ awk "/<node_state [^\n]*uname=\"$DRBD_PEER\"/,/<\/instance_attributes>/"|
+ grep -F -e "<nvpair ")
+ if [ -n "${node_attributes}" ] ; then
+ local shut_down=$(set +x; echo "$node_attributes" |
+ awk '/ name="shutdown"/ {if (match($0, /value=\"([[:digit:]]+)\"/, values)) {print values[1]} }')
+ if [ -n "${shut_down}" ] ; then
+ : "pacemaker considers this as clean down"
+ else
+ will_fence=true
+ fi
+ else
+ will_fence=true
+ fi
elif [[ $in_ccm = false ]] || [[ $crmd != "online" ]]; then
will_fence=true
fi

38
init-script-fixes.diff Normal file
View File

@ -0,0 +1,38 @@
diff -Naur drbd-utils-8.9.9.orig/scripts/drbd drbd-utils-8.9.9/scripts/drbd
--- drbd-utils-8.9.9.orig/scripts/drbd 2016-10-24 17:37:12.893292307 +0800
+++ drbd-utils-8.9.9/scripts/drbd 2016-10-24 17:38:56.728938286 +0800
@@ -9,14 +9,14 @@
#
### BEGIN INIT INFO
# Provides: drbd
-# Required-Start: $local_fs $network $syslog
-# Required-Stop: $local_fs $network $syslog
+# Required-Start: $remote_fs $network $syslog
+# Required-Stop: $remote_fs $network $syslog
# Should-Start: sshd multipathd
# Should-Stop: sshd multipathd
# Default-Start:
# Default-Stop: 0 1 6
-# X-Start-Before: heartbeat corosync
-# X-Stop-After: heartbeat corosync
+# X-Start-Before: pacemaker corosync
+# X-Stop-After: pacemaker corosync
# X-Interactive: true
# Short-Description: Control DRBD resources.
# Description: Control all DRBD resources.
@@ -184,7 +184,6 @@
done
done
- [ -d /var/lock/subsys ] && touch /var/lock/subsys/drbd # for RedHat
run_hook start_before-wait
$DRBDADM wait-con-int # User interruptible version of wait-connect all
run_hook start
@@ -256,7 +255,6 @@
fi
done
run_hook stop
- [ -f /var/lock/subsys/drbd ] && rm /var/lock/subsys/drbd
log_end_msg 0
;;
status)

View File

@ -0,0 +1,25 @@
diff -Naur drbd-utils-9.0.0.orig/scripts/global_common.conf drbd-utils-9.0.0/scripts/global_common.conf
--- drbd-utils-9.0.0.orig/scripts/global_common.conf 2017-10-16 17:02:55.715528259 +0800
+++ drbd-utils-9.0.0/scripts/global_common.conf 2017-10-16 17:07:49.755636558 +0800
@@ -47,10 +47,10 @@
}
disk {
- # size on-io-error fencing disk-barrier disk-flushes
+ # on-io-error disk-barrier disk-flushes
# disk-drain md-flushes resync-rate resync-after al-extents
- # c-plan-ahead c-delay-target c-fill-target c-max-rate
- # c-min-rate disk-timeout
+ # c-plan-ahead c-delay-target c-fill-target c-max-rate
+ # c-min-rate disk-timeout
}
net {
@@ -60,6 +60,6 @@
# after-sb-1pri after-sb-2pri always-asbp rr-conflict
# ping-timeout data-integrity-alg tcp-cork on-congestion
# congestion-fill congestion-extents csums-alg verify-alg
- # use-rle
+ # use-rle fencing
}
}

13
pie-fix.patch Normal file
View File

@ -0,0 +1,13 @@
Index: drbd-utils-9.14.0/user/drbdmon/Makefile.in
===================================================================
--- drbd-utils-9.14.0.orig/user/drbdmon/Makefile.in
+++ drbd-utils-9.14.0/user/drbdmon/Makefile.in
@@ -1,6 +1,7 @@
CXXFLAGS=-std=c++11 -I. -I../shared -Icppdsaext/src -Wall -Werror -pedantic-errors -fPIC -O2 \
-Wsign-compare -Wpointer-arith -Wswitch-default -Wswitch-enum -Wtype-limits \
--Wmissing-declarations -Wshadow
+-Wmissing-declarations -Wshadow \
+-pie
CXX = @CXX@
LIBS = @LIBS@

47
rpmlint-build-error.patch Normal file
View File

@ -0,0 +1,47 @@
Fix rpmlint Errors:
1. non-executable-script /usr/lib/ocf/resource.d/linbit/drbd.shellfuncs.sh 644 /bin/bash
2. filelist-forbidden-bashcomp-userdirs /etc/bash_completion.d/drbdadm.sh
3. dir-or-file-in-run /run/drbd
diff -Naur drbd-utils-9.19.0.orig/scripts/drbdadm.bash_completion drbd-utils-9.19.0/scripts/drbdadm.bash_completion
--- drbd-utils-9.19.0.orig/scripts/drbdadm.bash_completion 2021-10-11 18:44:02.906467704 +0800
+++ drbd-utils-9.19.0/scripts/drbdadm.bash_completion 2021-10-11 18:48:24.653422443 +0800
@@ -1,5 +1,5 @@
#
-# /etc/bash_completion.d/drbdadm
+# /usr/share/bash-completion/completions/drbdadm
#
# Bash completion for the DRBD top-level management application, drbdadm.
#
diff -Naur drbd-utils-9.19.0.orig/scripts/Makefile.in drbd-utils-9.19.0/scripts/Makefile.in
--- drbd-utils-9.19.0.orig/scripts/Makefile.in 2021-10-11 18:44:02.906467704 +0800
+++ drbd-utils-9.19.0/scripts/Makefile.in 2021-10-11 18:51:21.716712860 +0800
@@ -147,7 +147,7 @@
mkdir -p $(DESTDIR)/usr/lib/ocf/resource.d/linbit
install -m 755 drbd.ocf $(DESTDIR)/usr/lib/ocf/resource.d/linbit/drbd
install -m 755 drbd-attr $(DESTDIR)/usr/lib/ocf/resource.d/linbit/drbd-attr
- install -m 644 drbd.shellfuncs.sh $(DESTDIR)/usr/lib/ocf/resource.d/linbit/
+ install -m 755 drbd.shellfuncs.sh $(DESTDIR)/usr/lib/ocf/resource.d/linbit/
endif
install-rgmanager:
@@ -173,8 +173,8 @@
install-bashcompletion:
ifeq ($(WITH_BASHCOMPLETION),yes)
- mkdir -p $(DESTDIR)$(sysconfdir)/bash_completion.d
- install -m 644 drbdadm.bash_completion $(DESTDIR)$(sysconfdir)/bash_completion.d/drbdadm$(BASH_COMPLETION_SUFFIX)
+ mkdir -p $(DESTDIR)$(datadir)/bash-completion/completions
+ install -m 644 drbdadm.bash_completion $(DESTDIR)$(datadir)/bash-completion/completions/drbdadm
endif
clean:
@@ -195,7 +195,7 @@
rm -f $(DESTDIR)$(sysconfdir)/ha.d/resource.d/drbddisk
rm -f $(DESTDIR)$(sysconfdir)/ha.d/resource.d/drbdupper
rm -f $(DESTDIR)$(sysconfdir)/xen/scripts/block-drbd
- rm -f $(DESTDIR)$(sysconfdir)/bash_completion.d/drbdadm$(BASH_COMPLETION_SUFFIX)
+ rm -f $(DESTDIR)$(datadir)/bash-completion/completions/drbdadm
! test -L $(DESTDIR)/sbin/rcdrbd || rm $(DESTDIR)/sbin/rcdrbd
.PHONY: install uninstall clean distclean

View File

@ -0,0 +1,68 @@
https://en.opensuse.org/openSUSE:Usr_merge
diff -Naur drbd-utils-9.19.0.orig/scripts/Makefile.in drbd-utils-9.19.0/scripts/Makefile.in
--- drbd-utils-9.19.0.orig/scripts/Makefile.in 2021-10-11 17:59:20.189282860 +0800
+++ drbd-utils-9.19.0/scripts/Makefile.in 2021-10-11 18:01:25.988786913 +0800
@@ -39,6 +39,7 @@
UDEV_RULE_SUFFIX = @UDEV_RULE_SUFFIX@
INITDIR = @INITDIR@
LIBDIR = @prefix@/lib/@PACKAGE_TARNAME@
+LIBSCRIPTDIR = @prefix@/lib/@PACKAGE_TARNAME@/scripts
LN_S = @LN_S@
# features enabled or disabled by configure
@@ -87,11 +88,11 @@
install -d $(DESTDIR)$(systemdunitdir)
install -m 644 drbd.service $(DESTDIR)$(systemdunitdir)/
install -m 644 $(SYSTEMD_TEMPLATES) $(DESTDIR)$(systemdunitdir)/
- install -d $(DESTDIR)/lib/drbd/scripts
- install -m 755 drbd $(DESTDIR)/lib/drbd/scripts
- install -m 755 drbd-service-shim.sh $(DESTDIR)/lib/drbd/scripts
- install -m 755 drbd-wait-promotable.sh $(DESTDIR)/lib/drbd/scripts
- install -m 755 ocf.ra.wrapper.sh $(DESTDIR)/lib/drbd/scripts
+ install -d $(DESTDIR)$(LIBSCRIPTDIR)
+ install -m 755 drbd $(DESTDIR)$(LIBSCRIPTDIR)
+ install -m 755 drbd-service-shim.sh $(DESTDIR)$(LIBSCRIPTDIR)
+ install -m 755 drbd-wait-promotable.sh $(DESTDIR)$(LIBSCRIPTDIR)
+ install -m 755 ocf.ra.wrapper.sh $(DESTDIR)$(LIBSCRIPTDIR)
install -d $(DESTDIR)$(tmpfilesdir)/
install -m 444 drbd.tmpfiles.conf $(DESTDIR)$(tmpfilesdir)/drbd.conf
endif
diff -Naur drbd-utils-9.19.0.orig/user/v83/Makefile.in drbd-utils-9.19.0/user/v83/Makefile.in
--- drbd-utils-9.19.0.orig/user/v83/Makefile.in 2021-10-11 17:59:20.217282750 +0800
+++ drbd-utils-9.19.0/user/v83/Makefile.in 2021-10-11 18:07:39.967312613 +0800
@@ -98,11 +98,11 @@
install -d $(DESTDIR)$(localstatedir)/lock
install -d $(DESTDIR)/lib/drbd/
if getent group haclient > /dev/null 2> /dev/null ; then \
- install -g haclient -m 4750 drbdsetup-83 $(DESTDIR)/lib/drbd/ ; \
- install -m 755 drbdadm-83 $(DESTDIR)/lib/drbd/ ; \
+ install -g haclient -m 4750 drbdsetup-83 $(DESTDIR)$(LIBDIR) ; \
+ install -m 755 drbdadm-83 $(DESTDIR)$(LIBDIR) ; \
else \
- install -m 755 drbdsetup-83 $(DESTDIR)/lib/drbd/ ; \
- install -m 755 drbdadm-83 $(DESTDIR)/lib/drbd/ ; \
+ install -m 755 drbdsetup-83 $(DESTDIR)$(LIBDIR) ; \
+ install -m 755 drbdadm-83 $(DESTDIR)$(LIBDIR) ; \
fi
endif
diff -Naur drbd-utils-9.19.0.orig/user/v84/Makefile.in drbd-utils-9.19.0/user/v84/Makefile.in
--- drbd-utils-9.19.0.orig/user/v84/Makefile.in 2021-10-11 17:59:20.221282734 +0800
+++ drbd-utils-9.19.0/user/v84/Makefile.in 2021-10-11 18:07:39.967312613 +0800
@@ -112,11 +112,11 @@
install -d $(DESTDIR)$(localstatedir)/lock
install -d $(DESTDIR)/lib/drbd/
if getent group haclient > /dev/null 2> /dev/null ; then \
- install -g haclient -m 4750 drbdsetup-84 $(DESTDIR)/lib/drbd/ ; \
- install -m 755 drbdadm-84 $(DESTDIR)/lib/drbd/ ; \
+ install -g haclient -m 4750 drbdsetup-84 $(DESTDIR)$(LIBDIR) ; \
+ install -m 755 drbdadm-84 $(DESTDIR)$(LIBDIR) ; \
else \
- install -m 755 drbdsetup-84 $(DESTDIR)/lib/drbd/ ; \
- install -m 755 drbdadm-84 $(DESTDIR)/lib/drbd/ ; \
+ install -m 755 drbdsetup-84 $(DESTDIR)$(LIBDIR) ; \
+ install -m 755 drbdadm-84 $(DESTDIR)$(LIBDIR) ; \
fi
endif