tools: xenbackendd for NetBSD
PATCH 1/1 tools: xenbackendd for NetBSD
Hi!
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 xenbackendd on NetBSD only for now
- make xend launch xenbackendd on NetBSD only for now
Signature · 6 lines
---to satisfy European Law for business letters: Advanced Micro Devices GmbH Karl-Hammerschmidt-Str. 34, 85609 Dornach b. Muenchen Geschaeftsfuehrer: Thomas M. McCoy, Giuliano Meroni Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen Registergericht Muenchen, HRB Nr. 43632
tools/Makefile +1 -0
@@ -25,6 +25,7 @@ SUBDIRS-$(CONFIG_Linux) += blktap SUBDIRS-$(CONFIG_Linux) += blktap2 SUBDIRS-$(CONFIG_NetBSD) += libaio SUBDIRS-$(CONFIG_NetBSD) += blktap2 +SUBDIRS-$(CONFIG_NetBSD) += xenbackendd SUBDIRS-y += libfsimage SUBDIRS-$(LIBXENAPI_BINDINGS) += libxen SUBDIRS-$(CONFIG_Linux) += fs-back
tools/hotplug/NetBSD/Makefile +4 -4
@@ -3,9 +3,9 @@ include $(XEN_ROOT)/tools/Rules.mk # Xen script dir and scripts to go there. XEN_SCRIPTS = -XEN_SCRIPTS += block-nbsd -XEN_SCRIPTS += vif-bridge-nbsd -XEN_SCRIPTS += vif-ip-nbsd +XEN_SCRIPTS += block +XEN_SCRIPTS += vif-bridge +XEN_SCRIPTS += vif-ip XEN_SCRIPT_DATA =
@@ -23,7 +23,7 @@ install-scripts: $(INSTALL_DIR) $(DESTDIR)$(XEN_SCRIPT_DIR) set -e; for i in $(XEN_SCRIPTS); \ do \ - $(INSTALL_DATA) $$i $(DESTDIR)$(XEN_SCRIPT_DIR); \ + $(INSTALL_PROG) $$i $(DESTDIR)$(XEN_SCRIPT_DIR); \ done set -e; for i in $(XEN_SCRIPT_DATA); \ do \
tools/hotplug/NetBSD/block new file +91 -0
91 lines not on this page · raw message
tools/hotplug/NetBSD/block-nbsd deleted +0 -91
91 lines not on this page · raw message
tools/hotplug/NetBSD/vif-bridge new file +38 -0
@@ -0,0 +1,38 @@ +#!/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
tools/hotplug/NetBSD/vif-bridge-nbsd deleted +0 -38
@@ -1,38 +0,0 @@ -#!/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
tools/hotplug/NetBSD/vif-ip new file +36 -0
@@ -0,0 +1,36 @@ +#!/bin/sh -e + +# $NetBSD: vif-ip-nbsd,v 1.1.1.1 2008/08/07 20:26:57 cegger Exp $ +# Called by xenbackendd +# Usage: vif-ip 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) + xip=$(xenstore-read "$xpath/ip") + xfid=$(xenstore-read "$xpath/frontend-id") + xhandle=$(xenstore-read "$xpath/handle") + iface=xvif$xfid.$xhandle + echo ifconfig $iface $xip up + ifconfig $iface $xip up + xenstore-write $xpath/hotplug-status connected + echo xenstore-write $xpath/hotplug-status connected + exit 0 + ;; +*) + exit 0 + ;; +esac
tools/hotplug/NetBSD/vif-ip-nbsd deleted +0 -36
@@ -1,36 +0,0 @@ -#!/bin/sh -e - -# $NetBSD: vif-ip-nbsd,v 1.1.1.1 2008/08/07 20:26:57 cegger Exp $ -# Called by xenbackendd -# Usage: vif-ip 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) - xip=$(xenstore-read "$xpath/ip") - xfid=$(xenstore-read "$xpath/frontend-id") - xhandle=$(xenstore-read "$xpath/handle") - iface=xvif$xfid.$xhandle - echo ifconfig $iface $xip up - ifconfig $iface $xip up - xenstore-write $xpath/hotplug-status connected - echo xenstore-write $xpath/hotplug-status connected - exit 0 - ;; -*) - exit 0 - ;; -esac
tools/misc/xend +11 -0
@@ -107,6 +107,14 @@ def start_consoled(): def start_blktapctrl(): start_daemon("blktapctrl", "") +def start_xenbackendd(): + XENBACKENDD_DEBUG = os.getenv("XENBACKENDD_DEBUG") + args = "" + if XENBACKENDD_DEBUG: + args += "-d" + if os.uname()[0] == 'NetBSD': + start_daemon("xenbackendd", args) + def main(): try: check_logging()
@@ -121,11 +129,13 @@ def main(): if os.uname()[0] != "SunOS": start_xenstored() start_consoled() + start_xenbackendd() start_blktapctrl() return daemon.start() elif sys.argv[1] == 'trace_start': start_xenstored() start_consoled() + start_xenbackendd() start_blktapctrl() return daemon.start(trace=1) elif sys.argv[1] == 'stop':
@@ -135,6 +145,7 @@ def main(): elif sys.argv[1] == 'restart': start_xenstored() start_consoled() + start_xenbackendd() start_blktapctrl() return daemon.stop() or daemon.start() elif sys.argv[1] == 'status':
tools/xenbackendd/Makefile new file +41 -0
41 lines not on this page · raw message
tools/xenbackendd/xenbackendd.c new file +319 -0
319 lines not on this page · raw message
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel