f9a2cde352
in version numbers, and upgrade to 3.1.0. Changes since 3.0.4: * XenAPI 1.0 support o XML configuration files for virtual machines; o VM life-cycle management operations; and o Secure on- or off-box XML-RPC with bindings for many languages * Basic save/restore/migrate support for HVM (e.g. Windows) VMs; * Dynamic memory control for HVM guests; * 32-on-64 PV guest support (run PAE PV VMs on a 64-bit Xen!); and * Blktap copy-on-write disk support. It also fixes some HVM bugs.
88 lines
1.8 KiB
Bash
88 lines
1.8 KiB
Bash
#!/bin/sh -e
|
|
|
|
# $NetBSD: block-nbsd,v 1.1.1.1 2007/06/14 19:39:45 bouyer Exp $
|
|
# Called by xenbackendd
|
|
# Usage: block xsdir_backend_path state
|
|
|
|
PATH=/bin:/usr/bin:@PREFIX@/bin:/sbin:/usr/sbin:@PREFIX@/sbin
|
|
export PATH
|
|
|
|
error() {
|
|
echo "$@" >&2
|
|
xenstore_write $xpath/hotplug-status error
|
|
exit 1
|
|
}
|
|
|
|
|
|
xpath=$1
|
|
xstatus=$2
|
|
xtype=$(xenstore-read "$xpath/type")
|
|
xparams=$(xenstore-read "$xpath/params")
|
|
|
|
case $xstatus in
|
|
6)
|
|
# device removed
|
|
case $xtype in
|
|
file)
|
|
vnd=$(xenstore-read "$xpath/vnd" || echo none)
|
|
if [ $vnd != none ]; then
|
|
vnconfig -u $vnd
|
|
fi
|
|
;;
|
|
phy)
|
|
;;
|
|
*)
|
|
echo "unknown type $xtype" >&2
|
|
;;
|
|
esac
|
|
xenstore-rm $xpath
|
|
exit 0
|
|
;;
|
|
2)
|
|
case $xtype in
|
|
file)
|
|
# Store the list of available vnd(4) devices in
|
|
#``available_disks'', and mark them as ``free''.
|
|
list=`ls -1 /dev/vnd[0-9]*d | sed "s,/dev/vnd,,;s,d,," | sort -n`
|
|
for i in $list; do
|
|
disk="vnd$i"
|
|
available_disks="$available_disks $disk"
|
|
eval $disk=free
|
|
done
|
|
# Mark the used vnd(4) devices as ``used''.
|
|
for disk in `sysctl hw.disknames`; do
|
|
case $disk in
|
|
vnd[0-9]*) eval $disk=used ;;
|
|
esac
|
|
done
|
|
# Configure the first free vnd(4) device.
|
|
for disk in $available_disks; do
|
|
eval status=\$$disk
|
|
if [ "$status" = "free" ] && \
|
|
vnconfig /dev/${disk}d $xparams >/dev/null; then
|
|
device=/dev/${disk}d
|
|
echo vnconfig /dev/${disk}d $xparams
|
|
break
|
|
fi
|
|
done
|
|
if [ x$device = x ] ; then
|
|
error "no available vnd device"
|
|
fi
|
|
echo xenstore-write $xpath/vnd $device
|
|
xenstore-write $xpath/vnd $device
|
|
;;
|
|
phy)
|
|
device=$xparams
|
|
;;
|
|
esac
|
|
physical_device=$(stat -f '%r' "$device")
|
|
echo xenstore-write $xpath/physical-device $physical_device
|
|
xenstore-write $xpath/physical-device $physical_device
|
|
echo xenstore-write $xpath/hotplug-status connected
|
|
xenstore-write $xpath/hotplug-status connected
|
|
exit 0
|
|
;;
|
|
*)
|
|
exit 0
|
|
;;
|
|
esac
|