Files
xen/tools/hotplug/NetBSD/vif-bridge
T
Keir Fraser 9fe075decc tools: xenbackendd for NetBSD
Attached patch introduces xenbackendd. It is used on NetBSD
to launch the hotplug scripts. Later xenbackendd can be improved to
also launch qemu-dm as child process and will notice when qemu-dm
crashes.

The changes the patch makes:
- rename hotplug scripts as xenbackendd expects them
  (current names were taken from pkgsrc)
- install hotplug scripts as executable scripts
- introduce xenbackendd
- build/install/launch on NetBSD only

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
2009-07-22 14:37:30 +01:00

39 lines
790 B
Bash

#!/bin/sh -e
# $NetBSD: vif-bridge-nbsd,v 1.1.1.1 2008/08/07 20:26:57 cegger Exp $
# Called by xenbackendd
# Usage: vif-bridge xsdir_backend_path state
DIR=$(dirname "$0")
. "${DIR}/hotplugpath.sh"
PATH=${BINDIR}:${SBINDIR}:${LIBEXEC}:${PRIVATE_BINDIR}:/bin:/usr/bin:/sbin:/usr/sbin
export PATH
xpath=$1
xstatus=$2
case $xstatus in
6)
# device removed
xenstore-rm $xpath
exit 0
;;
2)
xbridge=$(xenstore-read "$xpath/bridge")
xfid=$(xenstore-read "$xpath/frontend-id")
xhandle=$(xenstore-read "$xpath/handle")
iface=xvif$xfid.$xhandle
echo ifconfig $iface up
ifconfig $iface up
brconfig $xbridge add $iface
echo brconfig $xbridge add $iface
xenstore-write $xpath/hotplug-status connected
echo xenstore-write $xpath/hotplug-status connected
exit 0
;;
*)
exit 0
;;
esac