Sync from SUSE:SLFO:Main drbd-utils revision 5ee7b4c7918341a2a0479bc5120b4454
This commit is contained in:
parent
fd49eba64d
commit
828b56b8cd
@ -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
|
||||
|
78
bsc-1233273_drbd.ocf-update-for-OCF-1.1.patch
Normal file
78
bsc-1233273_drbd.ocf-update-for-OCF-1.1.patch
Normal 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
|
||||
|
@ -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
|
||||
|
@ -1,3 +1,11 @@
|
||||
-------------------------------------------------------------------
|
||||
Tue Nov 12 10:00:52 UTC 2024 - Glass Su <glass.su@suse.com>
|
||||
|
||||
- drbd: Support and adaptations for OCF 1.1 standard (bsc#1233273)
|
||||
* bsc-1233273_drbd.ocf-replace-crm_master-with-ocf_promotion_score.patch
|
||||
* bsc-1233273_drbd.ocf-update-regex-of-sed-for-new-output-from-crm.patch
|
||||
* bsc-1233273_drbd.ocf-update-for-OCF-1.1.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Mar 18 11:21:52 UTC 2024 - Glass Su <glass.su@suse.com>
|
||||
|
||||
|
@ -56,6 +56,9 @@ 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
|
||||
#############################################
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user