File: offline

package info (click to toggle)
drbd-utils 9.5.0-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 5,388 kB
  • sloc: ansic: 43,698; xml: 15,968; cpp: 7,783; sh: 3,699; makefile: 1,353; perl: 353
file content (34 lines) | stat: -rwxr-xr-x 898 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/sh
# DRBDPrimary offline entry point
# Expects DRBD Resource Name in ResName attribute
#
# License: GPL-2.0
# Copyright (C) 2017 LINBIT HA-Solutions GmbH
# Roland Kammerer <roland.kammerer@linbit.com>
# Lars Ellenberg <lars.ellenberg@linbit.com>
###

LINBITvcsag_bin=/opt/LINBITvcsag/bin
drbd_inc=$LINBITvcsag_bin/drbd_inc.sh

. $drbd_inc || { >&2 echo "$0: Failed to source $drbd_inc"; exit 1; }

drbd_resource_state=$( ${DRBDSETUP} events2 --now "${DRBDRESNAME}" )
VCSAG_LOGDBG_MSG 3 "drbd_resource_state: $drbd_resource_state"

role_from_drbd_state "$drbd_resource_state"
role=$?

case $role in
	$DRBD_ROLE_UNNKOWN)
		VCSAG_LOGDBG_MSG 1 "apparently not even up" 0
		;;
	$DRBD_ROLE_SEC)
		VCSAG_LOGDBG_MSG 1 "already secondary" 0
		;;
	$DRBD_ROLE_PRI)
		VCSAG_LOGDBG_MSG 1 "trying to demote" 0
		${DRBDADM} secondary "${DRBDRESNAME}" || exit $VCSAG_EP_FAILED
		;;
esac
exit $VCSAG_EP_DONE