Add debian package for drbd-utils

CentOS version was upversioned and is very close to the Debian package.
Copied all patches. 1 needed small adjustment.

Needed to enable lintian overrides for upstream package.
Copied the drbd.service file from CentOS.

Did build drbd-utils. Did build iso.

Story: 2009101
Task: 43496
Signed-off-by: Dan Voiculeasa <dan.voiculeasa@windriver.com>
Change-Id: I44d5b67deb43b2894e7c0213666d54636f39cd40
This commit is contained in:
Dan Voiculeasa 2021-09-30 13:41:52 +03:00
parent 2e16e588d9
commit e861e7137f
11 changed files with 914 additions and 2 deletions

View File

@ -1,8 +1,9 @@
config/facter
config/puppet-5.5.22
config/puppet-modules/puppet-dnsmasq
config/puppet-modules/puppet-puppi
config/puppet-modules/puppet-rabbitmq-8.5.0
config/puppet-modules/puppet-staging
storage-drivers/trident-installer
config/puppet-5.5.22
filesystem/drbd/drbd-tools
filesystem/parted
storage-drivers/trident-installer

View File

@ -0,0 +1,23 @@
From 46fdbb58e056d5b2367279b542d0f905850721f6 Mon Sep 17 00:00:00 2001
From: Dan Voiculeasa <dan.voiculeasa@windriver.com>
Date: Thu, 30 Sep 2021 16:14:59 +0300
Subject: [PATCH] Add lintian overrides for StarlingX build env
Signed-off-by: Dan Voiculeasa <dan.voiculeasa@windriver.com>
---
debian/drbd-utils.lintian-overrides | 3 +++
1 file changed, 3 insertions(+)
create mode 100644 debian/drbd-utils.lintian-overrides
diff --git a/debian/drbd-utils.lintian-overrides b/debian/drbd-utils.lintian-overrides
new file mode 100644
index 0000000..e06133c
--- /dev/null
+++ b/debian/drbd-utils.lintian-overrides
@@ -0,0 +1,3 @@
+groff-message
+no-manual-page
+
--
2.30.0

View File

@ -0,0 +1,40 @@
From 0a471eff34696b8f1193574c205c74416618bbbf Mon Sep 17 00:00:00 2001
From: Dan Voiculeasa <dan.voiculeasa@windriver.com>
Date: Thu, 30 Sep 2021 17:50:58 +0300
Subject: [PATCH 2/2] Add drbd.service file
Copy file from CentOS.
Use service from /lib/drbd instead of /etc/rc.d/init.d/.
Signed-off-by: Dan Voiculeasa <dan.voiculeasa@windriver.com>
---
debian/drbd.service | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
create mode 100644 debian/drbd.service
diff --git a/debian/drbd.service b/debian/drbd.service
new file mode 100644
index 0000000..7624a18
--- /dev/null
+++ b/debian/drbd.service
@@ -0,0 +1,17 @@
+[Unit]
+Description=Control DRBD resources.
+After=network.target sshd.service
+
+[Service]
+Type=forking
+Restart=no
+KillMode=process
+RemainAfterExit=yes
+ExecStart=/lib/drbd/drbd start
+ExecStop=/lib/drbd//drbd stop
+ExecReload=/lib/drbd/drbd reload
+TimeoutSec=5min
+
+[Install]
+WantedBy=multi-user.target
+
--
2.30.0

View File

@ -0,0 +1,2 @@
0001-Add-lintian-overrides-for-StarlingX-build-env.patch
0002-Add-drbd.service-file.patch

View File

@ -0,0 +1,10 @@
---
debname: drbd-utils
debver: 9.15.0-1
dl_path:
name: drbd-utils-9.15.0-1.tar.gz
url: https://salsa.debian.org/ha-team/drbd-utils/-/archive/debian/9.15.0-1/drbd-utils-debian-9.15.0-1.tar.gz
md5sum: 84e55c54aa5223af1c2e3ed3f8fd6ad4
revision:
dist: $STX_DIST
PKG_GITREVCOUNT: true

View File

@ -0,0 +1,39 @@
From b1cd41d5b8b29c6137ae7cf7ce911725c41f7ef3 Mon Sep 17 00:00:00 2001
From: Dan Voiculeasa <dan.voiculeasa@windriver.com>
Date: Thu, 30 Sep 2021 14:23:11 +0300
Subject: [PATCH 1/5] drbd script
Clean copy of 0001_915-drbd-script.patch from CentOS.
Signed-off-by: Dan Voiculeasa <dan.voiculeasa@windriver.com>
---
scripts/drbd | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/scripts/drbd b/scripts/drbd
index bb70877..b422bff 100755
--- a/scripts/drbd
+++ b/scripts/drbd
@@ -211,7 +211,9 @@ case "$1" in
[ -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
+ if [ ! -e /etc/platform/simplex ] ; then # Skip if simplex
+ $DRBDADM wait-con-int # User interruptible version of wait-connect all
+ fi
run_hook start
# Become primary if configured
@@ -265,7 +267,7 @@ case "$1" in
for d in /dev/drbd* ; do
[ -L "$d" ] && continue
[ -b "$d" ] || continue
- M=$(umount "$d" 2>&1)
+ M=$(umount --all-targets "$d" 2>&1)
case $M in
*" not mounted") :;;
*) stop_failed=1; echo "$M" >&2 ;;
--
2.30.0

View File

@ -0,0 +1,664 @@
From 4ed13a54168847b9ef6f48e39021b5f365ddb52c Mon Sep 17 00:00:00 2001
From: Dan Voiculeasa <dan.voiculeasa@windriver.com>
Date: Thu, 30 Sep 2021 14:23:25 +0300
Subject: [PATCH 2/5] drbd ocf
Clean copy of 0002_915-drbd_ocf.patch from CentOS.
Signed-off-by: Dan Voiculeasa <dan.voiculeasa@windriver.com>
---
scripts/drbd.ocf | 471 ++++++++++++++++-------------------------------
1 file changed, 161 insertions(+), 310 deletions(-)
diff --git a/scripts/drbd.ocf b/scripts/drbd.ocf
index 7aafdcf..ff77c91 100755
--- a/scripts/drbd.ocf
+++ b/scripts/drbd.ocf
@@ -5,6 +5,8 @@
#
# Copyright (c) 2009 LINBIT HA-Solutions GmbH,
# Copyright (c) 2009 Florian Haas, Lars Ellenberg
+# Copyright (c) 2014 Wind River Systems, Inc. All rights reserved.
+#
# Based on the Heartbeat drbd OCF Resource Agent by Lars Marowsky-Bree
# (though it turned out to be an almost complete rewrite)
#
@@ -112,15 +114,6 @@ OCF_RESKEY_require_drbd_module_version_lt_default=9.1.0
init_optional_params()
{
- remove_master_score_if_peer_primary=false
- remove_master_score_if_peer_primary_only_if_unexpected=false
- if ocf_is_true ${OCF_RESKEY_remove_master_score_if_peer_primary:=false}; then
- remove_master_score_if_peer_primary=true
- elif [[ ${OCF_RESKEY_remove_master_score_if_peer_primary} = "unexpected" ]]; then
- remove_master_score_if_peer_primary=true
- remove_master_score_if_peer_primary_only_if_unexpected=true
- fi
-
if ocf_is_true ${OCF_RESKEY_fail_promote_early_if_peer_primary:=false}; then
fail_promote_early_if_peer_primary=true
else
@@ -562,35 +555,6 @@ do_drbdadm() {
return $ret
}
-# cached value
-unset current_master_score
-get_current_master_score()
-{
- # only call crm_master once
- [[ ${current_master_score+set} ]] ||
- current_master_score=$(crm_master -q -l reboot -G 2>/dev/null)
- # return value of this function:
- # true if master_score is present
- # false if master_score is not present
- [[ $current_master_score ]]
-}
-
-set_master_score() {
- # Use quiet mode (-Q) to quench logging. Actual score updates
- # will get logged by attrd anyway
- if [[ $1 -le 0 ]]; then
- remove_master_score
- else
- do_cmd ${HA_SBIN_DIR}/crm_master -Q -l reboot -v $1 &&
- current_master_score=$1
- fi
-}
-
-remove_master_score() {
- do_cmd ${HA_SBIN_DIR}/crm_master -l reboot -D
- current_master_score=""
-}
-
source_drbd_shellfuncs()
{
local dir=.
@@ -668,18 +632,11 @@ maybe_outdate_self()
ocf_log notice "outdating $DRBD_RESOURCE: according to OCF_RESKEY_CRM_meta_notify_master_uname, '$host' is still master"
do_drbdadm outdate $DRBD_RESOURCE
- # on some pacemaker versions, -INFINITY may cause resource instance stop/start.
- # But in this case that is ok, it may even clear the replication link
- # problem.
- set_master_score -INFINITY
-
return 0
}
unexpected_primary_rejects_promote()
{
- crm_resource_locate_master
-
: "single master config?"
[[ $OCF_RESKEY_CRM_meta_master_max = 1 ]] || return 1
: "not primary myself?" # because, if I am, I can no longer reject this...
@@ -691,208 +648,6 @@ unexpected_primary_rejects_promote()
return 0
}
-removed_master_score_because_peer_is_primary()
-{
- : "remove master score if peer primary?"; $remove_master_score_if_peer_primary || return 1
- : "primary myself?"; $status_primary && return 1
- : "some peer primary?"; $status_some_peer_primary || return 1
-
- if : "SOME peer ALL up-to-date?"; $status_some_peer_all_up_to_date ; then
- # FIXME this should check if that same primary peer has all healthy
- # disks, not if "some" peer has all healthy disks.
- # But I think this option only makes sense in two node setups,
- # so "some" peer becomes "the" peer anyways.
- : "Okay, peer apparently has healthy disks"
- else
- : "peer is primary, but does not look healthy, use regular master score adjustment"
- return 1
- fi
-
- if : "remove only if unexpected"; $remove_master_score_if_peer_primary_only_if_unexpected; then
- if unexpected_primary_rejects_promote; then
- ## Do not log "err", if this may be intentional (independent clusters),
- ## and this pacemaker was told to not even try to promote
- # case $OCF_RESKEY_CRM_meta_target_role in
- # [Mm]aster|[Ss]tarted|"")
- #
- ## But what if they control it via booth and tickets?
- ## Or other constraints?
-
- # do we even have a master score, currently?
- # logging this with every monitoring interval may be too noisy.
- if get_current_master_score ; then
- ocf_log info "I am connected to a Primary that Pacemaker does not know about! Removing master score."
- remove_master_score
- fi
- return 0
- fi
- : "not unexpected, no special treatment"
- return 1
- fi
-
- : "connected to (apparently healthy) Primary peer, do not allow promote"
- remove_master_score
- return 0
-}
-
-drbd_update_master_score() {
- set -- $OCF_RESKEY_adjust_master_score
- local only_consistent=$1 only_remote=$2 local_ok=$3 as_good_as_it_gets=$4
-
- # NOTE
- # there may be constraint scores from rules on role=Master,
- # that in some ways can add to the node attribute based master score we
- # specify below. If you think you want to add personal preferences,
- # in case the scores given by this RA do not suffice, this is the
- # value space you can work with:
- # -INFINITY: Do not promote. Really. Won't work anyways.
- # Too bad, at least with current (Oktober 2009) Pacemaker,
- # negative master scores cause instance stop; restart cycle :(
- # missing, zero: Do not promote.
- # I think my data is not good enough.
- # Though, of course, you may try, and it might even work.
- # 5: please, do not promote, unless this is your only option.
- # 10: promotion is probably a bad idea, our local data is no good,
- # you'd probably run into severe performance problems, and risk
- # application crashes or blocking IO in case you lose the
- # replication connection.
- # 1000: Ok to be promoted, we have good data locally (though we don't
- # know about the peer, so possibly it has even better data?).
- # You sould use the crm-fence-peer.sh handler or similar
- # mechanism to avoid data divergence.
- # 10000: Please promote me/keep me Primary.
- # I'm confident that my data is as good as it gets.
- #
- # TODO: separately configure the master score for diskless clients
- # For now: if it is "intentionally" diskless, and has access to
- # remote UpToDate, consider it slighly worse than "local_ok".
- #
- if : "have quorum?"; $status_have_quorum ; then
- : "quorate, evaluate status in more detail below"
- else
- : "NOT quorate, should not be master."
- remove_master_score
- return
- fi
-
- # I'd like to remove the master score, if we find ourselves be
- # connected to an "unexpected" primary:
- # # unexpected_primary_rejects_promote && remove_master_score
- #
- # BUT.
- # Given bad timing, DRBD may still think it is connected
- # but pacemaker already knows the peer is dead.
- # If now a "monitor" squeezes in between "peer known dead"
- # and the soon to be expected "promote", while DRBD still thinks it was
- # connected to a Primary (likely optimistically waiting for generously
- # configured internal timeouts), if we remove the master score from
- # this monitor action, we delay the failover for up to
- # time-for-DRBD-internals-to-declare-peer-dead
- # plus one extra monitor interval.
- #
- # So at least don't do that by default, check for
- # remove_master_score_if_peer_primary and
- # remove_master_score_if_peer_primary_only_if_unexpected
- #
- if removed_master_score_because_peer_is_primary ; then
- return
- fi
-
- if : "diskless client?"; $status_diskless_client ; then
- if : "primary and access to good data?" ;
- $status_primary && $status_some_peer_all_up_to_date; then
-
- set_master_score $(( as_good_as_it_gets -1 ))
- elif : "ALL peer-disks up-to-date?"; $status_pdsk_all_up_to_date; then
- set_master_score $(( as_good_as_it_gets -1 ))
- elif : "SOME peer-disks up-to-date?"; $status_some_peer_all_up_to_date ; then
- set_master_score $(( local_ok - 1 ))
- else : "Diskless client, without access to good data :("
- remove_master_score
- fi
-
- elif : "all disks up-to-date?"; $status_disk_all_up_to_date ; then
-
- if : "primary?" ; $status_primary ; then
-
- # I am Primary, all local disks are UpToDate
- set_master_score $as_good_as_it_gets
-
- if : "all peer-disks up-to-date?"; $status_pdsk_all_up_to_date; then
- # I am Primary, all local disks are UpToDate,
- # AND all peer disks are UpToDate
- : == DEBUG == unfence_if_all_uptodate=$unfence_if_all_uptodate
- $unfence_if_all_uptodate && call_unfence
-
- # else: not so sure about the peer's disks
- fi
- else : "Not primary."
- if : "any peer-disk unknown?"; $status_pdsk_any_unknown ; then
- # all local disks are UpToDate,
- # but I'm not Primary,
- # and I'm not sure about some peer's disk state(s).
- # We may need to outdate ourselves?
- # But if we outdate in a MONITOR, and are disconnected
- # secondary because of a hard primary crash, before CRM noticed
- # that there is no more master, we'd make us utterly useless!
- # Trust that the primary will also notice the disconnect,
- # and will place an appropriate fencing constraint via
- # its fence-peer handler callback.
- set_master_score $local_ok
- else : "all peer disk states known."
- # We know something about our peer, which means that either the
- # replication link is established, or it was not even
- # consistent last time we talked to each other.
- # Also all our local disks are UpToDate, which means even if we are
- # currently synchronizing, we do so as SyncSource.
- set_master_score $as_good_as_it_gets
- fi
- fi
-
- elif : "some peer with all peer-disks up-to-date?" ; $status_some_peer_all_up_to_date ; then
-
- # At least one of our local disks is not up to date.
- # But at least one of our peers is ALL OK.
- # We can expect to have access to useful
- # data, but with possibly degraded performance,
- # (some) reads need to fetch from the peer.
- set_master_score $only_remote
-
- elif : "in transitional state?"; $status_disk_transitional_state ; then
- # some transitional state.
- # just don't do anything
- : "ignore"
-
- elif : "all disks consistent?" ; $status_disk_all_consistent ; then
- # All local disks seem to be Consistent.
- # They _may_ be up to date, or not.
- # We hope that fencing mechanisms have put constraints in
- # place, so we won't be promoted with stale data.
- # But in case this was a cluster crash,
- # at least allow _someone_ to be promoted.
- set_master_score $only_consistent
-
- else # not $status_disk_all_consistent and not $status_disk_transitional_state
-
- # ALWAYS put the cluster in MAINTENANCE MODE
- # if you add a volume to a live replication group,
- # because the new volume will typically come up as Inconsistent
- # the first time, which would cause a monitor to revoke the
- # master score!
- #
- # At least some of our local disks are not really useable.
- # Our peer is not all good either (or some previous case block
- # would have matched). We have no access to useful data.
- # DRBD would refuse to be promoted, anyways.
- #
- # set_master_score -INFINITY
- # Too bad, at least with current (Oktober 2009) Pacemaker,
- # negative master scores cause instance stop; restart cycle :(
- # Hope that this will suffice.
- remove_master_score
- fi
-}
-
is_drbd_enabled() {
test -f /proc/drbd
}
@@ -939,6 +694,139 @@ drbd_status() {
return $rc
}
+drbd_condition() {
+ local status
+ local rc
+
+ status=$1
+ rc=$status
+
+ if [ $status -ne $OCF_SUCCESS -a $status -ne $OCF_RUNNING_MASTER ]
+ then
+ return $rc
+ fi
+
+ drbd_set_status_variables
+
+ ocf_log info "${OCF_RESKEY_drbd_resource} ${DRBD_ROLE_LOCAL}/${DRBD_DSTATE_LOCAL}/${DRBD_DSTATE_REMOTE} ${DRBD_CSTATE}"
+
+ case "${DRBD_DSTATE_LOCAL}" in
+ UpToDate)
+ case "${DRBD_CSTATE}" in
+ StandAlone)
+ rc=$OCF_DATA_STANDALONE
+ ocf_log info "${OCF_RESKEY_drbd_resource} standalone, attempting to reconnect."
+ do_drbdadm connect ${OCF_RESKEY_drbd_resource}
+ ;;
+ StartingSyncT | WFBitMapT | WFSyncUUID | SyncTarget | \
+ PausedSyncT)
+ rc=$OCF_DATA_SYNC
+ #drbd-overview | grep -A 1 drbd-cgcs | grep sync\'ed | cut -f2,3 -d' '
+ ocf_log info "${OCF_RESKEY_drbd_resource} syncing"
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ Consistent)
+ case "${DRBD_CSTATE}" in
+ StandAlone)
+ rc=$OCF_DATA_STANDALONE
+ ocf_log info "${OCF_RESKEY_drbd_resource} standalone, attempting to reconnect"
+ do_drbdadm connect ${OCF_RESKEY_drbd_resource}
+ ;;
+ *)
+ rc=$OCF_DATA_CONSISTENT
+ ocf_log info "${OCF_RESKEY_drbd_resource} consistent"
+ ;;
+ esac
+ ;;
+ Outdated)
+ case "${DRBD_CSTATE}" in
+ StandAlone)
+ rc=$OCF_DATA_STANDALONE
+ if [ $status -eq $OCF_SUCCESS ]
+ then
+ ocf_log info "${OCF_RESKEY_drbd_resource} outdated standalone, attempting to reconnect."
+ do_drbdadm -- --discard-my-data connect ${OCF_RESKEY_drbd_resource}
+ else
+ ocf_log info "${OCF_RESKEY_drbd_resource} outdated"
+ fi
+ ;;
+ *)
+ rc=$OCF_DATA_OUTDATED
+ ocf_log info "${OCF_RESKEY_drbd_resource} outdated"
+ esac
+ ;;
+ Inconsistent)
+ case "${DRBD_CSTATE}" in
+ StandAlone)
+ rc=$OCF_DATA_STANDALONE
+ if [ $status -eq $OCF_SUCCESS ]
+ then
+ ocf_log info "${OCF_RESKEY_drbd_resource} standby standalone, attempting to reconnect."
+ do_drbdadm connect ${OCF_RESKEY_drbd_resource}
+ else
+ ocf_log info "${OCF_RESKEY_drbd_resource} standalone"
+ fi
+ ;;
+ StartingSyncT | WFBitMapT | WFSyncUUID | SyncTarget | \
+ PausedSyncT)
+ rc=$OCF_DATA_SYNC
+ ocf_log info "${OCF_RESKEY_drbd_resource} sync"
+ ;;
+ *)
+ rc=$OCF_DATA_INCONSISTENT
+ ocf_log info "${OCF_RESKEY_drbd_resource} inconsistent"
+ ;;
+ esac
+ ;;
+ *)
+ case "${DRBD_CSTATE}" in
+ StandAlone)
+ rc=$OCF_DATA_STANDALONE
+ ocf_log info "${OCF_RESKEY_drbd_resource} standalone"
+ ;;
+ StartingSyncT | WFBitMapT | WFSyncUUID | SyncTarget | \
+ PausedSyncT)
+ rc=$OCF_DATA_SYNC
+ ocf_log info "${OCF_RESKEY_drbd_resource} sync"
+ ;;
+ *)
+ rc=$OCF_DATA_INCONSISTENT
+ ocf_log info "${OCF_RESKEY_drbd_resource} inconsistent"
+ ;;
+ esac
+ ;;
+ esac
+
+ if [ $status -eq $OCF_RUNNING_MASTER ]
+ then
+ if [ $rc -eq $OCF_DATA_INCONSISTENT ]
+ then
+ rc=$OCF_RUNNING_MASTER_DATA_INCONSISTENT
+
+ elif [ $rc -eq $OCF_DATA_OUTDATED ]
+ then
+ rc=$OCF_RUNNING_MASTER_DATA_OUTDATED
+
+ elif [ $rc -eq $OCF_DATA_CONSISTENT ]
+ then
+ rc=$OCF_RUNNING_MASTER_DATA_CONSISTENT
+
+ elif [ $rc -eq $OCF_DATA_SYNC ]
+ then
+ rc=$OCF_RUNNING_MASTER_DATA_SYNC
+
+ elif [ $rc -eq $OCF_DATA_STANDALONE ]
+ then
+ rc=$OCF_RUNNING_MASTER_DATA_STANDALONE
+ fi
+ fi
+
+ return $rc
+}
+
# I'm sorry, but there is no $OCF_DEGRADED_MASTER or similar yet.
drbd_monitor() {
local status
@@ -954,7 +842,8 @@ drbd_monitor() {
# ---
: "do nothing" ;
else
- drbd_update_master_score
+ drbd_condition $status
+ status=$?
fi
case $status in
@@ -976,17 +865,6 @@ drbd_monitor() {
return $status
}
-called_crm_resource_locate=false
-crm_resource_locate_master()
-{
- $called_crm_resource_locate && return
- 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' |
- grep -vix -m1 -e "$HOSTNAME")
-}
-
figure_out_drbd_peer_uname()
{
# depending on whether or not the peer is currently
@@ -1002,7 +880,6 @@ figure_out_drbd_peer_uname()
$OCF_RESKEY_CRM_meta_notify_demote_uname |
grep -vix -m1 -e "$HOSTNAME" )
DRBD_TO_PEER=${x:+ --peer $x}
- crm_resource_locate_master
}
my_udevsettle()
@@ -1020,6 +897,7 @@ my_udevsettle()
trap - TERM
return 0
}
+
create_device_udev_settle()
{
local dev
@@ -1129,7 +1007,8 @@ drbd_start()
# this is probably dead code.
# Also, ignore the exit code of adjust, as we are
# "running" already, anyways, right?
- rc=$OCF_SUCCESS
+ drbd_condition $OCF_SUCCESS
+ rc=$?
$connect_only_after_promote && break
do_connect
drbd_set_status_variables
@@ -1166,9 +1045,6 @@ drbd_start()
$first_try || sleep 1
first_try=false
done
- # in case someone does not configure monitor,
- # we must at least call it once after start.
- drbd_update_master_score
return $rc
}
@@ -1187,14 +1063,13 @@ drbd_reload() {
# Adjust resource just in case reload was requested manually
# Changes to resource parameters do not require this
do_drbdadm adjust $DRBD_RESOURCE
- rc=$OCF_SUCCESS
+ drbd_condition $OCF_SUCCESS
+ rc=$?
;;
$OCF_NOT_RUNNING)
:
;;
esac
- # Update score as adjust_master_score may be changed
- drbd_update_master_score
return $rc
}
@@ -1217,7 +1092,6 @@ drbd_promote() {
if ! $first_try && unexpected_primary_rejects_promote ; then
if $fail_promote_early_if_peer_primary ; then
drbd_ocf_exit_reason "Peer node already/still Primary"
- remove_master_score
break
else
ocf_log info "Peer node already/still Primary, promote will likely fail or need several attempts. Retrying anyways."
@@ -1239,7 +1113,8 @@ drbd_promote() {
break
;;
$OCF_RUNNING_MASTER)
- rc=$OCF_SUCCESS
+ drbd_condition $OCF_SUCCESS
+ rc=$?
if $connect_only_after_promote; then
figure_out_drbd_peer_uname
do_drbdadm $DRBD_TO_PEER -v adjust $DRBD_RESOURCE
@@ -1274,7 +1149,8 @@ drbd_demote() {
status=$?
case "$status" in
$OCF_SUCCESS)
- rc=$OCF_SUCCESS
+ drbd_condition $OCF_SUCCESS
+ rc=$?
break
;;
$OCF_NOT_RUNNING)
@@ -1316,7 +1192,21 @@ drbd_stop() {
;;
$OCF_RUNNING_MASTER)
ocf_log warn "$DRBD_RESOURCE still Primary, demoting."
- do_drbdadm secondary $DRBD_RESOURCE
+ found=no
+ for dev in ${DRBD_DEVICES[@]} ""; do
+ cat /proc/mounts | grep -q "^${dev} "
+ if [ $? -eq 0 ]; then
+ ocf_log warn "${DRBD_RESOURCE} is still mounted via $dev"
+ found=yes
+ break
+ fi
+ done
+ if [ "${found}" = "yes" ]; then
+ ocf_log warn "Waiting to drop $DRBD_RESOURCE"
+ else
+ ocf_log warn "Dropping $DRBD_RESOURCE to Secondary"
+ do_drbdadm secondary $DRBD_RESOURCE
+ fi
esac
$first_try || sleep 1
first_try=false
@@ -1326,14 +1216,9 @@ drbd_stop() {
# outdate myself in drbd on-disk meta data.
maybe_outdate_self
- # do not let old master scores laying around.
- # they may confuse crm if this node was set to standby.
- remove_master_score
-
return $rc
}
-
drbd_notify() {
local n_type=$OCF_RESKEY_CRM_meta_notify_type
local n_op=$OCF_RESKEY_CRM_meta_notify_operation
@@ -1370,7 +1255,6 @@ drbd_notify() {
# After something has been done is a good time to
# recheck our status:
drbd_set_status_variables
- drbd_update_master_score
if : "any unknown peer device?"; $status_pdsk_any_unknown ; then
# Still not properly communicating.
@@ -1402,27 +1286,6 @@ ls_stat_is_block_maj_147() {
[[ $1 = b* ]] && [[ $5 == 147,* ]]
}
-check_crm_feature_set()
-{
- set -- ${OCF_RESKEY_crm_feature_set//[!0-9]/ }
- local a=${1:-0} b=${2:-0} c=${3:-0}
-
- (( a > 3 )) ||
- (( a == 3 && b > 0 )) ||
- (( a == 3 && b == 0 && c > 0 )) ||
- ocf_log warn "You may be disappointed: This RA is intended for pacemaker 1.0 or better!"
-
- PCMK_OCF_DEGRADED=$OCF_SUCCESS
- PCMK_OCF_DEGRADED_MASTER=$OCF_RUNNING_MASTER
-
- ## pacemaker since crm_feature_set 3.0.10 knows about "degraded" states.
- ## But it does not work yet, because LRMD filters the exit codes...
- # if (( a > 3 )) || (( a == 3 && b > 0 )) || (( a == 3 && b == 0 && c >= 10 )); then
- # PCMK_OCF_DEGRADED=190
- # PCMK_OCF_DEGRADED_MASTER=191
- # fi
-}
-
require_drbd_module_version()
{
local v k op version_code
@@ -1489,7 +1352,6 @@ _drbd_validate_all () {
DRBD_HAS_EVENTS2=true
DRBD_IS_v9=true
fi
- check_crm_feature_set
if [[ $__OCF_ACTION != stop ]] ; then
meta_expect clone-node-max = 1 || return
@@ -1573,7 +1435,6 @@ _drbd_validate_all () {
# hm. probably misconfigured constraint somewhere.
# sorry. don't retry anywhere.
drbd_ocf_exit_reason "%s" "DRBD resource ${DRBD_RESOURCE} not found in configuration file ${OCF_RESKEY_drbdconf}."
- remove_master_score
: "$OCF_ERR_INSTALLED = OCF_ERR_INSTALLED"
return $OCF_ERR_INSTALLED
fi
@@ -1611,16 +1472,6 @@ _drbd_validate_all () {
fi
esac
- local i j n=0 fallback=false
- for i in $OCF_RESKEY_adjust_master_score; do
- [[ $i = *[!0-9]* ]] && fallback=true && ocf_log err "BAD adjust_master_score value $i ; falling back to default"
- [[ $j && $i -lt $j ]] && fallback=true && ocf_log err "BAD adjust_master_score value $j > $i ; falling back to default"
- j=$i
- n=$(( n+1 ))
- done
- [[ $n != 4 ]] && fallback=true && ocf_log err "Not enough adjust_master_score values ($n != 4); falling back to default"
- $fallback && OCF_RESKEY_adjust_master_score=$OCF_RESKEY_adjust_master_score_default
-
# we use it in various places,
# just make sure it contains what we expect.
HOSTNAME=`uname -n`
--
2.30.0

View File

@ -0,0 +1,59 @@
From 5e556644cae530eddb75487d2993cc7d88da8dc8 Mon Sep 17 00:00:00 2001
From: Dan Voiculeasa <dan.voiculeasa@windriver.com>
Date: Thu, 30 Sep 2021 14:32:11 +0300
Subject: [PATCH 3/5] Avoid kernel userspace version check
Copy of 0003_915-avoid-kernel-userspace-version-check.patch from
CentOS with very small adaptation.
Signed-off-by: Dan Voiculeasa <dan.voiculeasa@windriver.com>
---
user/v84/drbdadm_usage_cnt.c | 32 +-------------------------------
1 file changed, 1 insertion(+), 31 deletions(-)
diff --git a/user/v84/drbdadm_usage_cnt.c b/user/v84/drbdadm_usage_cnt.c
index 29e2dc2..7952233 100644
--- a/user/v84/drbdadm_usage_cnt.c
+++ b/user/v84/drbdadm_usage_cnt.c
@@ -244,37 +244,7 @@ static int vcs_ver_cmp(struct vcs_rel *rev1, struct vcs_rel *rev2)
void warn_on_version_mismatch(void)
{
- char *msg;
- int cmp;
-
- /* get the kernel module version from /proc/drbd */
- vcs_get_current();
-
- /* get the userland version from PACKAGE_VERSION */
- vcs_get_userland();
-
- cmp = vcs_ver_cmp(&userland_version, &current_vcs_rel);
- /* no message if equal */
- if (cmp == 0)
- return;
- if (cmp > 0xffff || cmp < -0xffff) /* major version differs! */
- msg = "mixing different major numbers will not work!";
- else if (cmp < 0) /* userland is older. always warn. */
- msg = "you should upgrade your drbd tools!";
- else if (cmp & 0xff00) /* userland is newer minor version */
- msg = "please don't mix different DRBD series.";
- else /* userland is newer, but only differ in sublevel. */
- return;
-
- fprintf(stderr, "DRBD module version: %u.%u.%u\n"
- " userland version: %u.%u.%u\n%s\n",
- current_vcs_rel.version.major,
- current_vcs_rel.version.minor,
- current_vcs_rel.version.sublvl,
- userland_version.version.major,
- userland_version.version.minor,
- userland_version.version.sublvl,
- msg);
+ return;
}
void add_lib_drbd_to_path(void)
--
2.30.0

View File

@ -0,0 +1,28 @@
From 40fde1bcdb9b9b1073c1c0ca15311be07b7c2dee Mon Sep 17 00:00:00 2001
From: Dan Voiculeasa <dan.voiculeasa@windriver.com>
Date: Thu, 30 Sep 2021 14:24:27 +0300
Subject: [PATCH 4/5] Increase short cmd timeout to 15 secs
Clean copy of 0004_915-Increase-short-cmd-timeout-to-15-secs.patch form
CentOS.
Signed-off-by: Dan Voiculeasa <dan.voiculeasa@windriver.com>
---
scripts/global_common.conf | 1 +
1 file changed, 1 insertion(+)
diff --git a/scripts/global_common.conf b/scripts/global_common.conf
index 12d83d5..13ad567 100644
--- a/scripts/global_common.conf
+++ b/scripts/global_common.conf
@@ -13,6 +13,7 @@ global {
# minor-count dialog-refresh disable-ip-verification
# cmd-timeout-short 5; cmd-timeout-medium 121; cmd-timeout-long 600;
+ cmd-timeout-short 15;
}
common {
--
2.30.0

View File

@ -0,0 +1,41 @@
From a2b14b7753e83a2cec7eacb583c242c6e4832603 Mon Sep 17 00:00:00 2001
From: Dan Voiculeasa <dan.voiculeasa@windriver.com>
Date: Thu, 30 Sep 2021 14:24:42 +0300
Subject: [PATCH 5/5] drbd overview
Clean copy of 0005_915-drbd-overview.patch from CentOS.
Signed-off-by: Dan Voiculeasa <dan.voiculeasa@windriver.com>
---
scripts/Makefile.in | 1 +
scripts/drbd-overview.pl | 2 --
2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/scripts/Makefile.in b/scripts/Makefile.in
index e2c6767..6fb6f98 100644
--- a/scripts/Makefile.in
+++ b/scripts/Makefile.in
@@ -102,6 +102,7 @@ endif
$(LN_S) -f notify.sh notify-emergency-reboot.sh ;\
$(LN_S) -f notify.sh notify-emergency-shutdown.sh ;\
$(LN_S) -f notify.sh notify-out-of-sync.sh; )
+ install -m 755 drbd-overview.pl $(DESTDIR)$(sbindir)/drbd-overview
ifeq ($(DISTRO),debian)
@ echo "Don't forget to run update-rc.d"
else
diff --git a/scripts/drbd-overview.pl b/scripts/drbd-overview.pl
index 3d2a397..22abdf4 100755
--- a/scripts/drbd-overview.pl
+++ b/scripts/drbd-overview.pl
@@ -413,8 +413,6 @@ eval {
warn "unrecognized value for --color" unless $use_colors =~ /^[01]$/;
};
-print STDERR "NOTE: drbd-overview will be deprecated soon.\nPlease consider using drbdtop.\n\n";
-
open STDERR, "/dev/null"
if $stderr_to_dev_null;
--
2.30.0

View File

@ -0,0 +1,5 @@
0001-drbd-script.patch
0002-drbd-ocf.patch
0003-Avoid-kernel-userspace-version-check.patch
0004-Increase-short-cmd-timeout-to-15-secs.patch
0005-drbd-overview.patch