ia64/xen-unstable

view tools/hotplug/NetBSD/block-nbsd @ 19848:5839491bbf20

[IA64] replace MAX_VCPUS with d->max_vcpus where necessary.

don't use MAX_VCPUS, and use vcpu::max_vcpus.
The changeset of 2f9e1348aa98 introduced max_vcpus to allow more vcpus
per guest. This patch is ia64 counter part.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author Isaku Yamahata <yamahata@valinux.co.jp>
date Mon Jun 29 11:26:05 2009 +0900 (2009-06-29)
parents 415505139333
children
line source
1 #!/bin/sh -e
3 # $NetBSD: block-nbsd,v 1.1.1.1 2008/08/07 20:26:57 cegger Exp $
4 # Called by xenbackendd
5 # Usage: block xsdir_backend_path state
7 DIR=$(dirname "$0")
8 . "${DIR}/hotplugpath.sh"
10 PATH=${BINDIR}:${SBINDIR}:${LIBEXEC}:${PRIVATE_BINDIR}:/bin:/usr/bin:/sbin:/usr/sbin
11 export PATH
13 error() {
14 echo "$@" >&2
15 xenstore_write $xpath/hotplug-status error
16 exit 1
17 }
20 xpath=$1
21 xstatus=$2
22 xtype=$(xenstore-read "$xpath/type")
23 xparams=$(xenstore-read "$xpath/params")
25 case $xstatus in
26 6)
27 # device removed
28 case $xtype in
29 file)
30 vnd=$(xenstore-read "$xpath/vnd" || echo none)
31 if [ $vnd != none ]; then
32 vnconfig -u $vnd
33 fi
34 ;;
35 phy)
36 ;;
37 *)
38 echo "unknown type $xtype" >&2
39 ;;
40 esac
41 xenstore-rm $xpath
42 exit 0
43 ;;
44 2)
45 case $xtype in
46 file)
47 # Store the list of available vnd(4) devices in
48 #``available_disks'', and mark them as ``free''.
49 list=`ls -1 /dev/vnd[0-9]*d | sed "s,/dev/vnd,,;s,d,," | sort -n`
50 for i in $list; do
51 disk="vnd$i"
52 available_disks="$available_disks $disk"
53 eval $disk=free
54 done
55 # Mark the used vnd(4) devices as ``used''.
56 for disk in `sysctl hw.disknames`; do
57 case $disk in
58 vnd[0-9]*) eval $disk=used ;;
59 esac
60 done
61 # Configure the first free vnd(4) device.
62 for disk in $available_disks; do
63 eval status=\$$disk
64 if [ "$status" = "free" ] && \
65 vnconfig /dev/${disk}d $xparams >/dev/null; then
66 device=/dev/${disk}d
67 echo vnconfig /dev/${disk}d $xparams
68 break
69 fi
70 done
71 if [ x$device = x ] ; then
72 error "no available vnd device"
73 fi
74 echo xenstore-write $xpath/vnd $device
75 xenstore-write $xpath/vnd $device
76 ;;
77 phy)
78 device=$xparams
79 ;;
80 esac
81 physical_device=$(stat -f '%r' "$device")
82 echo xenstore-write $xpath/physical-device $physical_device
83 xenstore-write $xpath/physical-device $physical_device
84 echo xenstore-write $xpath/hotplug-status connected
85 xenstore-write $xpath/hotplug-status connected
86 exit 0
87 ;;
88 *)
89 exit 0
90 ;;
91 esac