summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjym <jym>2011-01-12 00:11:19 +0000
committerjym <jym>2011-01-12 00:11:19 +0000
commit05ab28a422624ba40dfd71ce615f7ff8e39d3e7c (patch)
tree5883c10b57ecec6a2ea3c196f8fad56635c11832
parent863831e7b63b232e3f701a7aa966efc9bbf28c3e (diff)
downloadpkgsrc-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
-rw-r--r--sysutils/xentools3/Makefile6
-rw-r--r--sysutils/xentools3/PLIST3
-rw-r--r--sysutils/xentools3/files/vif-bridge-nbsd7
-rwxr-xr-xsysutils/xentools3/files/vif-ip-nbsd7
-rw-r--r--sysutils/xentools3/files/xen-subr-nbsd11
-rw-r--r--sysutils/xentools33/Makefile6
-rw-r--r--sysutils/xentools33/PLIST3
-rw-r--r--sysutils/xentools33/files/vif-bridge-nbsd7
-rwxr-xr-xsysutils/xentools33/files/vif-ip-nbsd7
-rw-r--r--sysutils/xentools33/files/xen-subr-nbsd11
10 files changed, 52 insertions, 16 deletions
diff --git a/sysutils/xentools3/Makefile b/sysutils/xentools3/Makefile
index 98351da43cd..48d811543bc 100644
--- a/sysutils/xentools3/Makefile
+++ b/sysutils/xentools3/Makefile
@@ -1,10 +1,10 @@
-# $NetBSD: Makefile,v 1.22 2010/10/08 04:58:58 obache Exp $
+# $NetBSD: Makefile,v 1.23 2011/01/12 00:11:19 jym Exp $
#
VERSION= 3.1.4
DISTNAME= xen-${VERSION}
PKGNAME= xentools3-${VERSION}
-PKGREVISION= 6
+PKGREVISION= 7
CATEGORIES= sysutils
MASTER_SITES= http://bits.xensource.com/oss-xen/release/${VERSION}/
EXTRACT_SUFX= .tar.gz
@@ -128,7 +128,7 @@ FILES_SUBST+= RCD_INTERPRETER=${PYTHONBIN:Q}
FILES_SUBST+= PROCPATH=${PROCPATH:Q}
FILES_SUBST+= PKG_SYSCONFDIR=${PKG_SYSCONFDIR:Q}
-XEND_SCRIPTS= block vif-bridge vif-ip
+XEND_SCRIPTS= block vif-bridge vif-ip xen-subr
CONF_FILES= ${EGDIR}/xend-config.sxp \
${PKG_SYSCONFDIR}/xend-config.sxp
diff --git a/sysutils/xentools3/PLIST b/sysutils/xentools3/PLIST
index ed9ebb3475e..3ff02d8d127 100644
--- a/sysutils/xentools3/PLIST
+++ b/sysutils/xentools3/PLIST
@@ -1,4 +1,4 @@
-@comment $NetBSD: PLIST,v 1.3 2009/06/14 18:16:21 joerg Exp $
+@comment $NetBSD: PLIST,v 1.4 2011/01/12 00:11:19 jym Exp $
bin/pygrub
bin/readnotes
bin/xc_restore
@@ -366,6 +366,7 @@ share/examples/xen/block
share/examples/xen/netbsd1
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/xentools3/files/vif-bridge-nbsd b/sysutils/xentools3/files/vif-bridge-nbsd
index a872085f186..487f69a347d 100644
--- a/sysutils/xentools3/files/vif-bridge-nbsd
+++ b/sysutils/xentools3/files/vif-bridge-nbsd
@@ -1,9 +1,12 @@
#!/bin/sh -e
-# $NetBSD: vif-bridge-nbsd,v 1.1.1.1 2007/06/14 19:39:45 bouyer Exp $
+# $NetBSD: vif-bridge-nbsd,v 1.2 2011/01/12 00:11:19 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/xentools3/files/vif-ip-nbsd b/sysutils/xentools3/files/vif-ip-nbsd
index a1a5f867f1d..1cc685f246a 100755
--- a/sysutils/xentools3/files/vif-ip-nbsd
+++ b/sysutils/xentools3/files/vif-ip-nbsd
@@ -1,9 +1,12 @@
#!/bin/sh -e
-# $NetBSD: vif-ip-nbsd,v 1.1.1.1 2007/06/14 19:39:45 bouyer Exp $
+# $NetBSD: vif-ip-nbsd,v 1.2 2011/01/12 00:11:19 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/xentools3/files/xen-subr-nbsd b/sysutils/xentools3/files/xen-subr-nbsd
new file mode 100644
index 00000000000..bda5a806e1b
--- /dev/null
+++ b/sysutils/xentools3/files/xen-subr-nbsd
@@ -0,0 +1,11 @@
+# $NetBSD: xen-subr-nbsd,v 1.1 2011/01/12 00:11:19 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"
+}
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"
+}