pkgsrc/sysutils/xentools45/patches/patch-hotplug_NetBSD_block
bad f6b41cc9d7 Use "stat -L" to determine the physical device. Now one can use lvm's
/dev/vgXXlvolYY symlinks in domU config files.
PKGREVISION++
2016-05-21 20:11:21 +00:00

45 lines
1.2 KiB
Text

$NetBSD: patch-hotplug_NetBSD_block,v 1.3 2016/05/21 20:11:21 bad Exp $
Lock the block script to avoid races during vnd configuration.
Use "stat -L" to get device major/minor numbers through symlinks e.g. for
lvm volumes.
--- hotplug/NetBSD/block.orig 2016-03-23 14:57:27.000000000 +0100
+++ hotplug/NetBSD/block 2016-05-21 17:08:01.000000000 +0200
@@ -6,8 +6,9 @@
DIR=$(dirname "$0")
. "${DIR}/hotplugpath.sh"
+. "${DIR}/locking.sh"
-PATH=${BINDIR}:${SBINDIR}:${LIBEXEC_BIN}:/bin:/usr/bin:/sbin:/usr/sbin
+PATH=${BINDIR}:${SBINDIR}:${LIBEXEC}:${PRIVATE_BINDIR}:/bin:/usr/bin:/sbin:/usr/sbin
export PATH
error() {
@@ -62,6 +63,7 @@
available_disks="$available_disks $disk"
eval $disk=free
done
+ claim_lock block
# Mark the used vnd(4) devices as ``used''.
for disk in `sysctl hw.disknames`; do
case $disk in
@@ -77,6 +79,7 @@
break
fi
done
+ release_lock block
if [ x$device = x ] ; then
error "no available vnd device"
fi
@@ -86,7 +89,7 @@
device=$xparams
;;
esac
- physical_device=$(stat -f '%r' "$device")
+ physical_device=$(stat -L -f '%r' "$device")
xenstore-write $xpath/physical-device $physical_device
xenstore-write $xpath/hotplug-status connected
exit 0