Note: "permalinks" may not be as permanent as we would like,
direct links of old sources may well be a few messages off.
On Wednesday 10 September 2008 16:39:24 Richard Pijnenburg wrote:
> Dear List,
>
> I'm trying out LVM over DRBD and primarly it works.
> But when i try to force a hardware failure of the first node ( power
> off ) heartbeat want's to switch over the second storage node, so that
> goes good.
> The only bad thing is that i get the error " Device is held open by
> someone "
>
> I've stopped the iscsi ( ietd ) manualy but that didn't help.
> So i'm thinking there is something still holding it open, my best
> quess is lvm.
>
> My current setup:
>
> sdb1 -> drbd0 -> pv -> vg -> lv's
>
> Does anyone have a tought about it what it could be ?
You need to tell LVM to give it up:
vgchange -an drbd0vgname
I hacked a vgchange resource script for this purpose (see below).
My configuration worked 100% with heartbeat v1. If you have a semi-working
heartbeat v2 config to share, that would be wonderful! I have nothing but
forced reboots to show for my efforts with v2 :(
#!/bin/bash
#
# This script is a heartbeat resource script
#
# Make a LVM volume available
# public domain
#
###
if [ "$#" -eq 2 ]; then
RES="$1"
CMD="$2"
else
RES="all"
CMD="$1"
fi
case "$CMD" in
start)
/sbin/vgchange -ay $RES
;;
stop)
/sbin/vgchange -an $RES
rc=$?
case $rc in
0)
exit 0
;;
*)
echo >&2 "/sbin/vgchange -an $RES: exit code $rc, returning 0"
exit 0
;;
esac
;;
status)
lvm vgs | grep -q "^ *$RES " && exit 0
exit 3 # LSB status "service is not running"
;;
*)
echo "Usage: vgchange [resource] {start|stop|status}"
exit 1
;;
esac
exit 0