File skip_sh-b-pri_in_v9.patch of Package drbd-utils.5899

skipping running sh-b-pri in drbd9 to avoid warning.

diff -Naur drbd-utils-9.0.0.orig/scripts/drbd drbd-utils-9.0.0/scripts/drbd
--- drbd-utils-9.0.0.orig/scripts/drbd	2017-10-16 17:02:55.707528280 +0800
+++ drbd-utils-9.0.0/scripts/drbd	2017-10-16 17:34:02.134427141 +0800
@@ -55,6 +55,13 @@
     . /lib/lsb/init-functions
 fi
 
+local DRBD_VERSION DRBD_IS_V9=false
+DRBD_VERSION="$($DRBDADM --version 2>/dev/null | grep DRBD_KERNEL_VERSION_CODE | cut -d '=' -f 2)"
+if (( $DRBD_VERSION >= 0x090000 ))
+then
+    DRBD_IS_V9=true
+fi
+
 assure_module_is_loaded()
 {
     [ -e "$PROC_DRBD" ] && return
@@ -191,7 +198,8 @@
 	# Become primary if configured
 	# Currently, this is necessary for drbd8
 	# drbd9 supports automatic promote and removes the "sh-b-pri" command.
-	$DRBDADM sh-b-pri all || true
+	# Do not run "$DRBDADM sh-b-pri all" in v8
+	$DRBD_IS_V9 || $DRBDADM sh-b-pri all || true
 	log_end_msg 0
 
 	# Now handle stacked devices, if any
@@ -218,7 +226,7 @@
 		    done
 		done
 		$DRBDADM -S wait-con-int # User interruptible version of wait-connect all
-		$DRBDADM -S sh-b-pri all || true
+		$DRBD_IS_V9 || $DRBDADM -S sh-b-pri all || true
 		log_end_msg 0
 	    fi
 	fi
openSUSE Build Service is sponsored by