Add initial meta-stx to support StarlingX build
[pti/rtp.git] / meta-stx / recipes-support / drbd / drbd-utils / 0007-Update-OCF-to-attempt-connect-in-certain-states.patch
1 From 5677e262d5b3f5ecc114f1aace4ffd77a7772282 Mon Sep 17 00:00:00 2001
2 From: Don Penney <don.penney@windriver.com>
3 Date: Tue, 21 Feb 2017 12:37:02 -0500
4 Subject: [PATCH] Update OCF to attempt connect in certain states
5
6 ---
7  scripts/drbd.ocf | 17 +++++++++++++++--
8  1 file changed, 15 insertions(+), 2 deletions(-)
9
10 diff --git a/scripts/drbd.ocf b/scripts/drbd.ocf
11 index 0e26ea9..84332b0 100644
12 --- a/scripts/drbd.ocf
13 +++ b/scripts/drbd.ocf
14 @@ -415,8 +415,21 @@ drbd_condition() {
15              esac
16              ;;
17          Outdated)
18 -            rc=$OCF_DATA_OUTDATED
19 -            ocf_log info "${OCF_RESKEY_drbd_resource} outdated"
20 +            case "${DRBD_CSTATE}" in
21 +                StandAlone)
22 +                    rc=$OCF_DATA_STANDALONE
23 +                    if [ $status -eq $OCF_SUCCESS ]
24 +                    then
25 +                        ocf_log info "${OCF_RESKEY_drbd_resource} outdated standalone, attempting to reconnect."
26 +                        do_drbdadm -- --discard-my-data connect ${OCF_RESKEY_drbd_resource}
27 +                    else
28 +                        ocf_log info "${OCF_RESKEY_drbd_resource} outdated"
29 +                    fi
30 +                    ;;
31 +                *)
32 +                    rc=$OCF_DATA_OUTDATED
33 +                    ocf_log info "${OCF_RESKEY_drbd_resource} outdated"
34 +            esac
35              ;;
36          Inconsistent)
37              case "${DRBD_CSTATE}" in
38 -- 
39 1.8.3.1
40