drbd-utils: update for stx 5.0

* inherit stx-metadata to help apply updated patches
  from stx 'integ' repo

* remove the local copy of stx files and patches

Issue-ID: INF-215

Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
Change-Id: I581835bd6787f2619c71a784b1c3afa8ed5f339c
diff --git a/meta-starlingx/meta-stx-integ/recipes-support/drbd/drbd-utils/0001-skip_wait_con_int_on_simplex.patch b/meta-starlingx/meta-stx-integ/recipes-support/drbd/drbd-utils/0001-skip_wait_con_int_on_simplex.patch
deleted file mode 100644
index bb43fa4..0000000
--- a/meta-starlingx/meta-stx-integ/recipes-support/drbd/drbd-utils/0001-skip_wait_con_int_on_simplex.patch
+++ /dev/null
@@ -1,16 +0,0 @@
-diff --git a/scripts/drbd b/scripts/drbd
-index f45f258..7640097 100755
---- a/scripts/drbd
-+++ b/scripts/drbd
-@@ -160,7 +160,10 @@ case "$1" in
- 	done
- 
- 	[ -d /var/lock/subsys ] && touch /var/lock/subsys/drbd	# for RedHat
--	$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
- 
- 	$DRBDADM sh-b-pri all # Become primary if configured
- 	log_end_msg 0
diff --git a/meta-starlingx/meta-stx-integ/recipes-support/drbd/drbd-utils/0002-drbd-conditional-crm-dependency.patch b/meta-starlingx/meta-stx-integ/recipes-support/drbd/drbd-utils/0002-drbd-conditional-crm-dependency.patch
deleted file mode 100644
index f423dfc..0000000
--- a/meta-starlingx/meta-stx-integ/recipes-support/drbd/drbd-utils/0002-drbd-conditional-crm-dependency.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-diff --git a/scripts/drbd.ocf b/scripts/drbd.ocf
-index 2105209..0aa9702 100644
---- a/scripts/drbd.ocf
-+++ b/scripts/drbd.ocf
-@@ -217,13 +217,17 @@ do_drbdadm() {
- }
- 
- set_master_score() {
--	# Use quiet mode (-Q) to quench logging. Actual score updates
--	# will get logged by attrd anyway
--	do_cmd ${HA_SBIN_DIR}/crm_master -Q -l reboot -v $1
-+	if [ -x ${HA_SBIN_DIR}/crm_master ]; then
-+		# Use quiet mode (-Q) to quench logging. Actual score updates
-+		# will get logged by attrd anyway
-+		do_cmd ${HA_SBIN_DIR}/crm_master -Q -l reboot -v $1
-+	fi
- }
- 
- remove_master_score() {
--	do_cmd ${HA_SBIN_DIR}/crm_master -l reboot -D
-+	if [ -x ${HA_SBIN_DIR}/crm_master ]; then
-+		do_cmd ${HA_SBIN_DIR}/crm_master -l reboot -D
-+	fi
- }
- 
- _sh_status_process() {
diff --git a/meta-starlingx/meta-stx-integ/recipes-support/drbd/drbd-utils/0003-drbd_report_condition.patch b/meta-starlingx/meta-stx-integ/recipes-support/drbd/drbd-utils/0003-drbd_report_condition.patch
deleted file mode 100644
index 7103dc9..0000000
--- a/meta-starlingx/meta-stx-integ/recipes-support/drbd/drbd-utils/0003-drbd_report_condition.patch
+++ /dev/null
@@ -1,387 +0,0 @@
----
- scripts/drbd     |    1 
- scripts/drbd.ocf |  259 ++++++++++++++++++++++---------------------------------
- 2 files changed, 109 insertions(+), 151 deletions(-)
-
---- 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)
- #
-@@ -216,20 +218,6 @@ do_drbdadm() {
- 	return $ret
- }
- 
--set_master_score() {
--	if [ -x ${HA_SBIN_DIR}/crm_master ]; then
--		# Use quiet mode (-Q) to quench logging. Actual score updates
--		# will get logged by attrd anyway
--		do_cmd ${HA_SBIN_DIR}/crm_master -Q -l reboot -v $1
--	fi
--}
--
--remove_master_score() {
--	if [ -x ${HA_SBIN_DIR}/crm_master ]; then
--		do_cmd ${HA_SBIN_DIR}/crm_master -l reboot -D
--	fi
--}
--
- _sh_status_process() {
- 	# _volume not present should not happen,
- 	# but may help make this agent work even if it talks to drbd 8.3.
-@@ -242,6 +230,7 @@ _sh_status_process() {
- 	DRBD_DSTATE_LOCAL[$_volume]=${_disk:-Unconfigured}
- 	DRBD_DSTATE_REMOTE[$_volume]=${_pdsk:-DUnknown}
- }
-+
- drbd_set_status_variables() {
- 	# drbdsetup sh-status prints these values to stdout,
- 	# and then prints _sh_status_process.
-@@ -322,119 +311,9 @@ 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
- }
- 
--drbd_update_master_score() {
--	# 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.
--	#
--	# For multi volume, we need to compare who is "better" a bit more sophisticated.
--	# The ${XXX[*]//UpToDate}, without being in double quotes, results in a single space,
--	# if all are UpToDate.
--	: == DEBUG == ${DRBD_ROLE_LOCAL[*]}/${DRBD_DSTATE_LOCAL[*]//UpToDate/ }/${DRBD_DSTATE_REMOTE[*]//UpToDate/ }/ ==
--	case ${DRBD_ROLE_LOCAL[*]}/${DRBD_DSTATE_LOCAL[*]//UpToDate/ }/${DRBD_DSTATE_REMOTE[*]//UpToDate/ }/ in
--	*Primary*/\ /*/)
--		# I am Primary, all local disks are UpToDate
--		set_master_score 10000
--		;;
--	*/\ /*DUnknown*/)
--		# all local disks are UpToDate,
--		# but I'm not Primary,
--		# and I'm not sure about the 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  1000
--		;;
--	*/\ /*/)
--		# 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 10000
--		;;
--
--	*/*/\ /)
--		# At least one of our local disks is not up to date.
--		# But our peer is ALL OK.
--		# We can expect to have access to useful
--		# data, but must expect degraded performance.
--		set_master_score 10
--		;;
--	*/*Attaching*/*/|\
--	*/*Negotiating*/*/)
--		# some transitional state.
--		# just don't do anything
--		: ;;
--
--	Unconfigured*|\
--	*/*Diskless*/*/|\
--	*/*Failed*/*/|\
--	*/*Inconsistent*/*/|\
--	*/*Outdated*/*/)
--		# 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
--		;;
--	*)
--		# 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 5
--		;;
--	esac
--
--	return $OCF_SUCCESS
--}
--
- is_drbd_enabled() {
- 	test -f /proc/drbd
- }
-@@ -488,7 +367,103 @@ drbd_status() {
- 	return $rc
- }
- 
--# I'm sorry, but there is no $OCF_DEGRADED_MASTER or similar yet.
-+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)
-+            rc=$OCF_DATA_OUTDATED
-+            ocf_log info "${OCF_RESKEY_drbd_resource} outdated"
-+            ;;
-+        *)
-+            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
-+}
-+
- drbd_monitor() {
- 	local status
- 
-@@ -501,7 +476,8 @@ drbd_monitor() {
- 	drbd_status
- 	status=$?
- 
--	drbd_update_master_score
-+	drbd_condition $status
-+	status=$?
- 
- 	return $status
- }
-@@ -578,7 +554,8 @@ drbd_start() {
- 			# "running" already, anyways, right?
- 			figure_out_drbd_peer_uname
- 			do_drbdadm $DRBD_TO_PEER adjust $DRBD_RESOURCE
--			rc=$OCF_SUCCESS
-+			drbd_condition $OCF_SUCCESS
-+            rc=$?
- 			break
- 			;;
- 		$OCF_NOT_RUNNING)
-@@ -606,9 +583,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
- }
-@@ -642,7 +616,8 @@ drbd_promote() {
- 			break
- 			;;
- 		$OCF_RUNNING_MASTER)
--			rc=$OCF_SUCCESS
-+			drbd_condition $OCF_SUCCESS
-+            rc=$?
- 			break
- 		esac
- 		$first_try || sleep 1
-@@ -666,7 +641,8 @@ drbd_demote() {
- 		status=$?
- 		case "$status" in
- 		$OCF_SUCCESS)
--			rc=$OCF_SUCCESS
-+			drbd_condition $OCF_SUCCESS
-+            rc=$?
- 			break
- 			;;
- 		$OCF_NOT_RUNNING)
-@@ -718,14 +694,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
-@@ -760,7 +731,6 @@ drbd_notify() {
- 		# After something has been done is a good time to
- 		# recheck our status:
- 		drbd_set_status_variables
--		drbd_update_master_score
- 
- 		: == DEBUG == ${DRBD_DSTATE_REMOTE[*]} ==
- 		case ${DRBD_DSTATE_REMOTE[*]} in
-@@ -793,17 +763,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!"
--}
--
- drbd_validate_all () {
- 	DRBDADM="drbdadm"
- 	DRBDSETUP="drbdsetup"
-@@ -821,7 +780,6 @@ drbd_validate_all () {
- 	if (( $DRBDADM_VERSION_CODE >= 0x080400 )); then
- 		DRBD_HAS_MULTI_VOLUME=true
- 	fi
--	check_crm_feature_set
- 
- 	# Check clone and M/S options.
- 	meta_expect clone-max -le 2
-@@ -890,7 +848,6 @@ drbd_validate_all () {
- 			# hm. probably misconfigured constraint somewhere.
- 			# sorry. don't retry anywhere.
- 			ocf_log err "DRBD resource ${DRBD_RESOURCE} not found in configuration file ${OCF_RESKEY_drbdconf}."
--			remove_master_score
- 			return $OCF_ERR_INSTALLED
- 		fi
- 	fi
---- a/scripts/drbd
-+++ b/scripts/drbd
-@@ -4,6 +4,7 @@
- # description: Loads and unloads the drbd module
- #
- # Copyright 2001-2010 LINBIT
-+# Copyright (c) 2014 Wind River Systems, Inc. All rights reserved.
- #
- # Philipp Reisner, Lars Ellenberg
- #
diff --git a/meta-starlingx/meta-stx-integ/recipes-support/drbd/drbd-utils/0004-drbdadm-ipaddr-change.patch b/meta-starlingx/meta-stx-integ/recipes-support/drbd/drbd-utils/0004-drbdadm-ipaddr-change.patch
deleted file mode 100644
index a2bb2a2..0000000
--- a/meta-starlingx/meta-stx-integ/recipes-support/drbd/drbd-utils/0004-drbdadm-ipaddr-change.patch
+++ /dev/null
@@ -1,132 +0,0 @@
-Index: git/user/drbdadm_adjust.c
-===================================================================
---- git.orig/user/drbdadm_adjust.c
-+++ git/user/drbdadm_adjust.c
-@@ -157,6 +157,7 @@ static int opts_equal(struct context_def
- static int addr_equal(struct d_resource* conf, struct d_resource* running)
- {
- 	int equal;
-+    char *peer_addr, *peer_af, *peer_port;
- 
- 	if (conf->peer == NULL && running->peer == NULL) return 1;
- 	if (running->peer == NULL) return 0;
-@@ -165,16 +166,29 @@ static int addr_equal(struct d_resource*
- 		!strcmp(conf->me->port,           running->me->port) &&
- 		!strcmp(conf->me->address_family, running->me->address_family);
- 
--	if(conf->me->proxy)
--		equal = equal &&
--			!strcmp(conf->me->proxy->inside_addr, running->peer->address) &&
--			!strcmp(conf->me->proxy->inside_port, running->peer->port) &&
--			!strcmp(conf->me->proxy->inside_af,   running->peer->address_family);
--	else
--		equal = equal && conf->peer &&
--			!strcmp(conf->peer->address,        running->peer->address) &&
--			!strcmp(conf->peer->port,           running->peer->port) &&
--			!strcmp(conf->peer->address_family, running->peer->address_family);
-+       if(conf->me->proxy) {
-+               peer_addr = conf->me->proxy->inside_addr;
-+               peer_port = conf->me->proxy->inside_port;
-+               peer_af = conf->me->proxy->inside_af;
-+       } else {
-+               peer_addr = conf->peer->address;
-+               peer_port = conf->peer->port;
-+               peer_af = conf->peer->address_family;
-+       }
-+
-+       equal = equal && conf->peer &&
-+               !strcmp(peer_addr, running->peer->address) &&
-+               !strcmp(peer_port, running->peer->port) &&
-+               !strcmp(peer_af, running->peer->address_family);
-+
-+       if (verbose > 2)
-+               fprintf(stderr, "Network addresses differ:\n"
-+                       "\trunning: %s:%s:%s -- %s:%s:%s\n"
-+                       "\t config: %s:%s:%s -- %s:%s:%s\n",
-+                       running->me->address_family, running->me->address, running->me->port,
-+                       running->peer->address_family, running->peer->address, running->peer->port,
-+                       conf->me->address_family, conf->me->address, conf->me->port,
-+                       peer_af, peer_addr, peer_port);
- 
- 	return equal;
- }
-@@ -690,8 +704,7 @@ int adm_adjust(struct cfg_ctx *ctx)
- 	if (ctx->res->me->proxy && can_do_proxy)
- 		do_connect |= proxy_reconf(ctx, running);
- 
--	if (do_connect && running)
--		do_disconnect = running->net_options != NULL;
-+    do_disconnect = do_connect && running && (running->peer || running->net_options);
- 
- 	if (do_res_options)
- 		schedule_deferred_cmd(adm_set_default_res_options, ctx, "resource-options", CFG_RESOURCE);
-@@ -716,8 +729,12 @@ int adm_adjust(struct cfg_ctx *ctx)
- 	}
- 
- 	if (do_connect) {
--		if (do_disconnect && ctx->res->peer)
--			schedule_deferred_cmd(adm_disconnect, ctx, "disconnect", CFG_NET_PREREQ);
-+        /* "disconnect" specifying the end-point addresses currently in-use,
-+         * before "connect"ing with the addresses currently in-config-file. */
-+        if (do_disconnect) {
-+                struct cfg_ctx tmp_ctx = { .res = running, .vol = vol, };
-+                schedule_deferred_cmd(adm_disconnect, &tmp_ctx, "disconnect", CFG_NET_PREREQ);
-+        }
- 		schedule_deferred_cmd(adm_connect, ctx, "connect", CFG_NET);
- 		do_net_options = 0;
- 	}
-Index: git/user/legacy/drbdadm_adjust.c
-===================================================================
---- git.orig/user/legacy/drbdadm_adjust.c
-+++ git/user/legacy/drbdadm_adjust.c
-@@ -133,6 +133,7 @@ static int opts_equal(struct d_option* c
- static int addr_equal(struct d_resource* conf, struct d_resource* running)
- {
- 	int equal;
-+    char *peer_addr, *peer_af, *peer_port;
- 
- 	if (conf->peer == NULL && running->peer == NULL) return 1;
- 	if (running->peer == NULL) return 0;
-@@ -141,18 +142,31 @@ static int addr_equal(struct d_resource*
- 		!strcmp(conf->me->port,           running->me->port) &&
- 		!strcmp(conf->me->address_family, running->me->address_family);
- 
--	if(conf->me->proxy)
--		equal = equal &&
--			!strcmp(conf->me->proxy->inside_addr, running->peer->address) &&
--			!strcmp(conf->me->proxy->inside_port, running->peer->port) &&
--			!strcmp(conf->me->proxy->inside_af,   running->peer->address_family);
--	else
--		equal = equal && conf->peer &&
--			!strcmp(conf->peer->address,        running->peer->address) &&
--			!strcmp(conf->peer->port,           running->peer->port) &&
--			!strcmp(conf->peer->address_family, running->peer->address_family);
-+    if(conf->me->proxy) {
-+            peer_addr = conf->me->proxy->inside_addr;
-+            peer_port = conf->me->proxy->inside_port;
-+            peer_af = conf->me->proxy->inside_af;
-+    } else {
-+            peer_addr = conf->peer->address;
-+            peer_port = conf->peer->port;
-+            peer_af = conf->peer->address_family;
-+    }
-+
-+    equal = equal && conf->peer &&
-+            !strcmp(peer_addr, running->peer->address) &&
-+            !strcmp(peer_port, running->peer->port) &&
-+            !strcmp(peer_af, running->peer->address_family);
-+
-+    if (verbose > 2)
-+            fprintf(stderr, "Network addresses differ:\n"
-+                    "\trunning: %s:%s:%s -- %s:%s:%s\n"
-+                    "\t config: %s:%s:%s -- %s:%s:%s\n",
-+                    running->me->address_family, running->me->address, running->me->port,
-+                    running->peer->address_family, running->peer->address, running->peer->port,
-+                    conf->me->address_family, conf->me->address, conf->me->port,
-+                    peer_af, peer_addr, peer_port);
- 
--	return equal;
-+    return equal;
- }
- 
- static int proto_equal(struct d_resource* conf, struct d_resource* running)
diff --git a/meta-starlingx/meta-stx-integ/recipes-support/drbd/drbd-utils/0005-drbd_reconnect_standby_standalone.patch b/meta-starlingx/meta-stx-integ/recipes-support/drbd/drbd-utils/0005-drbd_reconnect_standby_standalone.patch
deleted file mode 100644
index 30444c7..0000000
--- a/meta-starlingx/meta-stx-integ/recipes-support/drbd/drbd-utils/0005-drbd_reconnect_standby_standalone.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-Index: git/scripts/drbd.ocf
-===================================================================
---- git.orig/scripts/drbd.ocf
-+++ git/scripts/drbd.ocf
-@@ -418,6 +418,29 @@ drbd_condition() {
-             rc=$OCF_DATA_OUTDATED
-             ocf_log info "${OCF_RESKEY_drbd_resource} outdated"
-             ;;
-+        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)
diff --git a/meta-starlingx/meta-stx-integ/recipes-support/drbd/drbd-utils/0006-avoid-kernel-userspace-version-check.patch b/meta-starlingx/meta-stx-integ/recipes-support/drbd/drbd-utils/0006-avoid-kernel-userspace-version-check.patch
deleted file mode 100644
index 8cd3cc7..0000000
--- a/meta-starlingx/meta-stx-integ/recipes-support/drbd/drbd-utils/0006-avoid-kernel-userspace-version-check.patch
+++ /dev/null
@@ -1,55 +0,0 @@
-From ea19e3020367cfaf6da20dd690433ee72a24120c Mon Sep 17 00:00:00 2001
-From: Don Penney <don.penney@windriver.com>
-Date: Mon, 2 May 2016 15:17:54 -0400
-Subject: [PATCH 1/1] Avoid kernel/userspace version check
-
----
- user/drbdadm_usage_cnt.c | 32 +-------------------------------
- 1 file changed, 1 insertion(+), 31 deletions(-)
-
-diff --git a/user/drbdadm_usage_cnt.c b/user/drbdadm_usage_cnt.c
-index ff6d5c8..c6cb4ad 100644
---- a/user/drbdadm_usage_cnt.c
-+++ b/user/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 REL_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. */
--		msg = "preferably kernel and userland versions should match.";
--
--	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)
--- 
-1.8.3.1
-
diff --git a/meta-starlingx/meta-stx-integ/recipes-support/drbd/drbd-utils/0007-Update-OCF-to-attempt-connect-in-certain-states.patch b/meta-starlingx/meta-stx-integ/recipes-support/drbd/drbd-utils/0007-Update-OCF-to-attempt-connect-in-certain-states.patch
deleted file mode 100644
index 9ff4001..0000000
--- a/meta-starlingx/meta-stx-integ/recipes-support/drbd/drbd-utils/0007-Update-OCF-to-attempt-connect-in-certain-states.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-From 5677e262d5b3f5ecc114f1aace4ffd77a7772282 Mon Sep 17 00:00:00 2001
-From: Don Penney <don.penney@windriver.com>
-Date: Tue, 21 Feb 2017 12:37:02 -0500
-Subject: [PATCH] Update OCF to attempt connect in certain states
-
----
- scripts/drbd.ocf | 17 +++++++++++++++--
- 1 file changed, 15 insertions(+), 2 deletions(-)
-
-diff --git a/scripts/drbd.ocf b/scripts/drbd.ocf
-index 0e26ea9..84332b0 100644
---- a/scripts/drbd.ocf
-+++ b/scripts/drbd.ocf
-@@ -415,8 +415,21 @@ drbd_condition() {
-             esac
-             ;;
-         Outdated)
--            rc=$OCF_DATA_OUTDATED
--            ocf_log info "${OCF_RESKEY_drbd_resource} 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
--- 
-1.8.3.1
-
diff --git a/meta-starlingx/meta-stx-integ/recipes-support/drbd/drbd-utils/0008-Increase-short-cmd-timeout-to-15-secs.patch b/meta-starlingx/meta-stx-integ/recipes-support/drbd/drbd-utils/0008-Increase-short-cmd-timeout-to-15-secs.patch
deleted file mode 100644
index 097e975..0000000
--- a/meta-starlingx/meta-stx-integ/recipes-support/drbd/drbd-utils/0008-Increase-short-cmd-timeout-to-15-secs.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From 100b44d99b0bcbac92abd2122becbfd88d155e09 Mon Sep 17 00:00:00 2001
-From: Don Penney <don.penney@windriver.com>
-Date: Wed, 22 Nov 2017 20:45:28 -0500
-Subject: [PATCH] Increase short cmd timeout to 15 secs
-
----
- user/drbdadm_main.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/user/drbdadm_main.c b/user/drbdadm_main.c
-index b89e91a..19c5a44 100644
---- a/user/drbdadm_main.c
-+++ b/user/drbdadm_main.c
-@@ -1467,7 +1467,7 @@ void m__system(char **argv, int flags, const char *res_name, pid_t *kid, int *fd
- 		alarm_raised = 0;
- 		switch (flags & SLEEPS_MASK) {
- 		case SLEEPS_SHORT:
--			timeout = 5;
-+			timeout = 15;
- 			break;
- 		case SLEEPS_LONG:
- 			timeout = COMM_TIMEOUT + 1;
--- 
-1.8.3.1
-
diff --git a/meta-starlingx/meta-stx-integ/recipes-support/drbd/drbd-utils/0009-Check-for-mounted-device-before-demoting-Primary-DRB.patch b/meta-starlingx/meta-stx-integ/recipes-support/drbd/drbd-utils/0009-Check-for-mounted-device-before-demoting-Primary-DRB.patch
deleted file mode 100644
index ac8f414..0000000
--- a/meta-starlingx/meta-stx-integ/recipes-support/drbd/drbd-utils/0009-Check-for-mounted-device-before-demoting-Primary-DRB.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-From 017157d21a56410811384a43d0b0cbba6444baeb Mon Sep 17 00:00:00 2001
-From: Don Penney <don.penney@windriver.com>
-Date: Wed, 6 Feb 2019 01:19:59 -0500
-Subject: [PATCH] Check for mounted device before demoting Primary DRBD
- resource
-
-Update the OCF script to check for a mounted device when demoting
-a resource that's in the Primary state. The state change will fail
-if it is still in use, otherwise.
-
-Signed-off-by: Don Penney <don.penney@windriver.com>
----
- scripts/drbd.ocf | 16 +++++++++++++++-
- 1 file changed, 15 insertions(+), 1 deletion(-)
-
-diff --git a/scripts/drbd.ocf b/scripts/drbd.ocf
-index e03bf6d..95da11a 100644
---- a/scripts/drbd.ocf
-+++ b/scripts/drbd.ocf
-@@ -720,7 +720,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
--- 
-1.8.3.1
-
diff --git a/meta-starlingx/meta-stx-integ/recipes-support/drbd/drbd-utils_8.4.3.bbappend b/meta-starlingx/meta-stx-integ/recipes-support/drbd/drbd-utils_8.4.3.bbappend
index 1c14e13..0dd36b7 100644
--- a/meta-starlingx/meta-stx-integ/recipes-support/drbd/drbd-utils_8.4.3.bbappend
+++ b/meta-starlingx/meta-stx-integ/recipes-support/drbd/drbd-utils_8.4.3.bbappend
@@ -1,17 +1,24 @@
 
-FILESEXTRAPATHS_append := ":${THISDIR}/${PN}:"
+inherit stx-metadata
 
+STX_REPO = "integ"
+STX_SUBPATH = "filesystem/drbd/drbd-tools/centos"
+
+SRC_URI_STX += " \
+	file://patches/0001-skip_wait_con_int_on_simplex.patch \
+	file://patches/0002-drbd-conditional-crm-dependency.patch \
+	file://patches/0003-drbd_report_condition.patch \
+	file://patches/0004-drbdadm-ipaddr-change.patch \
+	file://patches/0005-drbd_reconnect_standby_standalone.patch \
+	file://patches/0006-avoid-kernel-userspace-version-check.patch \
+	file://patches/0007-Update-OCF-to-attempt-connect-in-certain-states.patch \
+	file://patches/0008-Increase-short-cmd-timeout-to-15-secs.patch \
+	file://patches/0009-Check-for-mounted-device-before-demoting-Primary-DRB.patch \
+	file://patches/0010-backport-drbd-main-ipv6-Fix-interface-indices-larger.patch \
+	file://patches/0011-Unmount-all-targets-during-drbd-stop.patch \
+	"
 
 SRC_URI += " \
-	file://0001-skip_wait_con_int_on_simplex.patch \
-	file://0002-drbd-conditional-crm-dependency.patch \
-	file://0003-drbd_report_condition.patch \
-	file://0004-drbdadm-ipaddr-change.patch \
-	file://0005-drbd_reconnect_standby_standalone.patch \
-	file://0006-avoid-kernel-userspace-version-check.patch \
-	file://0007-Update-OCF-to-attempt-connect-in-certain-states.patch \
-	file://0008-Increase-short-cmd-timeout-to-15-secs.patch \
-	file://0009-Check-for-mounted-device-before-demoting-Primary-DRB.patch \
 	file://0010-Include-sysmacros-for-major-minor-macros.patch \
 	file://0011-Disable-documentation.patch \
 	file://drbd.service \