|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH V2] libxl: support custom block hotplug scripts
On Wed, 2012-08-01 at 10:57 +0100, Ian Campbell wrote:
> I have tested with a custom block script which uses "lvchange -a" to
> dynamically add remove the referenced device (simulates iSCSI login/logout
> without requiring me to faff around setting up an iSCSI target).
Script below for reference. Configured with:
'access=w,vdev=xvde,script=block-lvm,target=VG=VG LV=trash'
Once you've done the initial "lvchange -a n /dev/VG/trash" then you
should find that /dv/VG/trash exists only when the domain exists.
I deliberately chose a target with = in it to valid the "target= eats to
end of line" use case. As expected it works, the params node ends up as
"VG=VG LV=trash". This also exercised the behaviour of not stat()ing the
device in libxl.
8<-------------------------------------------
#!/bin/bash
dir=$(dirname "$0")
. "$dir/block-common.sh"
p=$(xenstore_read "$XENBUS_PATH/params")
evalVariables $p
exec 1>>/tmp/block-lvm.log
DEV=/dev/$VG/$LV
echo block-lvm $command on `date`
echo VG=$VG LV=$LV DEV=$DEV
case "$command" in
add)
if [ -e $DEV ] ; then
fatal "$DEV already active, disable with \`lvchange -a n $DEV\'"
fi
lvchange -a y $DEV
write_dev $DEV
exit 0
;;
remove)
lvchange -a n $DEV
exit 0
;;
esac
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |