diff options
author | jym <jym> | 2011-01-12 00:11:19 +0000 |
---|---|---|
committer | jym <jym> | 2011-01-12 00:11:19 +0000 |
commit | 05ab28a422624ba40dfd71ce615f7ff8e39d3e7c (patch) | |
tree | 5883c10b57ecec6a2ea3c196f8fad56635c11832 /sysutils/xentools33 | |
parent | 863831e7b63b232e3f701a7aa966efc9bbf28c3e (diff) | |
download | pkgsrc-05ab28a422624ba40dfd71ce615f7ff8e39d3e7c.tar.gz |
Add support for "vifname" keys inside XenStore. Its value is the
interface name for the vif, e.g. xvif(4) for dom0, and xennet(4)
for domU.
This allows querying the XenStore for the vif names, rather than
hardcoding their syntax in vif-* scripts.
Add a xen-subr shell script that can contain customized functions, and
include it in the vif-ip/vif-bridge scripts.
Introduce xenstore_read_default that returns the value of a specific
key from XenStore, or the default specified value when key is absent.
Bump revision.
ok bouyer@.
See http://mail-index.netbsd.org/port-xen/2011/01/11/msg006405.html
Diffstat (limited to 'sysutils/xentools33')
-rw-r--r-- | sysutils/xentools33/Makefile | 6 | ||||
-rw-r--r-- | sysutils/xentools33/PLIST | 3 | ||||
-rw-r--r-- | sysutils/xentools33/files/vif-bridge-nbsd | 7 | ||||
-rwxr-xr-x | sysutils/xentools33/files/vif-ip-nbsd | 7 | ||||
-rw-r--r-- | sysutils/xentools33/files/xen-subr-nbsd | 11 |
5 files changed, 26 insertions, 8 deletions
diff --git a/sysutils/xentools33/Makefile b/sysutils/xentools33/Makefile index eceee099472..12c9e235ad9 100644 --- a/sysutils/xentools33/Makefile +++ b/sysutils/xentools33/Makefile @@ -1,10 +1,10 @@ -# $NetBSD: Makefile,v 1.22 2010/10/30 20:06:52 tnn Exp $ +# $NetBSD: Makefile,v 1.23 2011/01/12 00:12:13 jym Exp $ # VERSION= 3.3.2 DISTNAME= xen-${VERSION} PKGNAME= xentools33-${VERSION} -PKGREVISION= 4 +PKGREVISION= 5 CATEGORIES= sysutils MASTER_SITES= http://bits.xensource.com/oss-xen/release/${VERSION}/ EXTRACT_SUFX= .tar.gz @@ -133,7 +133,7 @@ FILES_SUBST+= PKG_SYSCONFDIR=${PKG_SYSCONFDIR:Q} BLKTAP_FILES= blk_netbsd.c blktapctrl_netbsd.c -XEND_SCRIPTS= block vif-bridge vif-ip qemu-ifup +XEND_SCRIPTS= block vif-bridge vif-ip qemu-ifup xen-subr CONF_FILES= ${EGDIR}/formats ${PKG_SYSCONFDIR}/formats diff --git a/sysutils/xentools33/PLIST b/sysutils/xentools33/PLIST index cace582c824..0bc1d368722 100644 --- a/sysutils/xentools33/PLIST +++ b/sysutils/xentools33/PLIST @@ -1,4 +1,4 @@ -@comment $NetBSD: PLIST,v 1.9 2009/08/07 12:49:21 cegger Exp $ +@comment $NetBSD: PLIST,v 1.10 2011/01/12 00:12:13 jym Exp $ bin/lsevtchn bin/pygrub bin/readnotes @@ -512,6 +512,7 @@ share/examples/xen/${LOWER_OPSYS}1 share/examples/xen/qemu-ifup share/examples/xen/vif-bridge share/examples/xen/vif-ip +share/examples/xen/xen-subr share/examples/xen/xend-config.sxp share/examples/xen/xmexample1 share/examples/xen/xmexample2 diff --git a/sysutils/xentools33/files/vif-bridge-nbsd b/sysutils/xentools33/files/vif-bridge-nbsd index 2c2b6d0ea37..662f2fe09d0 100644 --- a/sysutils/xentools33/files/vif-bridge-nbsd +++ b/sysutils/xentools33/files/vif-bridge-nbsd @@ -1,9 +1,12 @@ #!/bin/sh -e -# $NetBSD: vif-bridge-nbsd,v 1.1.1.1 2008/08/07 20:26:57 cegger Exp $ +# $NetBSD: vif-bridge-nbsd,v 1.2 2011/01/12 00:12:14 jym Exp $ # Called by xenbackendd # Usage: vif-bridge xsdir_backend_path state +dir=$(dirname $0) +. "$dir/xen-subr" + PATH=/bin:/usr/bin:@PREFIX@/bin:/sbin:/usr/sbin:@PREFIX@/sbin export PATH @@ -20,7 +23,7 @@ case $xstatus in xbridge=$(xenstore-read "$xpath/bridge") xfid=$(xenstore-read "$xpath/frontend-id") xhandle=$(xenstore-read "$xpath/handle") - iface=xvif$xfid.$xhandle + iface=$(xenstore_read_default "$xpath/vifname" "xvif$xfid.$xhandle") echo ifconfig $iface up ifconfig $iface up brconfig $xbridge add $iface diff --git a/sysutils/xentools33/files/vif-ip-nbsd b/sysutils/xentools33/files/vif-ip-nbsd index b16de280ccc..6b5b985d158 100755 --- a/sysutils/xentools33/files/vif-ip-nbsd +++ b/sysutils/xentools33/files/vif-ip-nbsd @@ -1,9 +1,12 @@ #!/bin/sh -e -# $NetBSD: vif-ip-nbsd,v 1.1.1.1 2008/08/07 20:26:57 cegger Exp $ +# $NetBSD: vif-ip-nbsd,v 1.2 2011/01/12 00:12:14 jym Exp $ # Called by xenbackendd # Usage: vif-ip xsdir_backend_path state +dir=$(dirname $0) +. "$dir/xen-subr" + PATH=/bin:/usr/bin:@PREFIX@/bin:/sbin:/usr/sbin:@PREFIX@/sbin export PATH @@ -20,7 +23,7 @@ case $xstatus in xip=$(xenstore-read "$xpath/ip") xfid=$(xenstore-read "$xpath/frontend-id") xhandle=$(xenstore-read "$xpath/handle") - iface=xvif$xfid.$xhandle + iface=$(xenstore_read_default "$xpath/vifname" "xvif$xfid.$xhandle") echo ifconfig $iface $xip up ifconfig $iface $xip up xenstore-write $xpath/hotplug-status connected diff --git a/sysutils/xentools33/files/xen-subr-nbsd b/sysutils/xentools33/files/xen-subr-nbsd new file mode 100644 index 00000000000..f0235fad828 --- /dev/null +++ b/sysutils/xentools33/files/xen-subr-nbsd @@ -0,0 +1,11 @@ +# $NetBSD: xen-subr-nbsd,v 1.1 2011/01/12 00:12:14 jym Exp $ +# +# Contains commonly used functions which are used by Xen scripts + +# xenstore_read_default path default +# +# Read the given path in XenStore. Return default if path does not exist +# +xenstore_read_default() { + xenstore-read "$1" 2>/dev/null || echo "$2" +} |