[DRBD-user] [PATCH 1/4] drbd.ocf: Implement reload operation

Vladislav Bogdanov bubble at hoster-ok.com
Mon Feb 29 16:10:35 CET 2016

Note: "permalinks" may not be as permanent as we would like,
direct links of old sources may well be a few messages off.


Now OCF RA has plenty of parameters, most of them are external to drbd
itself. Allow to change that parameters without resource restart.
As an added value, adjust resource configuration just in case the
reload operation was requested by administrator
(if https://github.com/ClusterLabs/pacemaker/pull/606 is going to be
merged).
---
 scripts/drbd.ocf |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/scripts/drbd.ocf b/scripts/drbd.ocf
index 632e16e..5c87d32 100755
--- a/scripts/drbd.ocf
+++ b/scripts/drbd.ocf
@@ -263,6 +263,7 @@ See description of unfence_if_all_uptodate.
 
 <actions>
 <action name="start"   timeout="240" />
+<action name="reload"  timeout="30" />
 <action name="promote"	 timeout="90" />
 <action name="demote"	timeout="90" />
 <action name="notify"	timeout="90" />
@@ -790,6 +791,32 @@ drbd_start() {
 	return $rc
 }
 
+drbd_reload() {
+	local rc
+	local status
+
+	rc=$OCF_ERR_GENERIC
+
+	drbd_status
+	status=$?
+
+	case "$status" in
+	$OCF_SUCCESS|$OCF_RUNNING_MASTER)
+		# 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
+		;;
+	$OCF_NOT_RUNNING)
+		:
+		;;
+	esac
+	# Update score as adjust_master_score may be changed
+	drbd_update_master_score
+
+	return $rc
+}
+
 drbd_promote() {
 	local rc
 	local status
@@ -1187,6 +1214,9 @@ start)
 stop)
 	drbd_stop
 	;;
+reload)
+	drbd_reload
+	;;
 notify)
 	drbd_notify
 	;;
-- 
1.7.1




More information about the drbd-user mailing list