summaryrefslogtreecommitdiff
path: root/sysutils/xe-guest-utilities
diff options
context:
space:
mode:
authorsborrill <sborrill@pkgsrc.org>2011-10-03 16:57:03 +0000
committersborrill <sborrill@pkgsrc.org>2011-10-03 16:57:03 +0000
commit06ccee30675525a73f2a86b268f1ea28eb86ad1a (patch)
tree9d2b80b2d543de0b33ebe0b3d3dbdb6ecf1a3aa7 /sysutils/xe-guest-utilities
parent757025e83e6b48286dca9bc6e4dd1e0629fd3ada (diff)
downloadpkgsrc-06ccee30675525a73f2a86b268f1ea28eb86ad1a.tar.gz
NetBSD can run as a paravirtualised guest of Citrix XenServer using
XEN3PAE_DOMU (i386) or XEN3_DOMU (amd64) kernels. To get full functionality, guest VMs must provide run-time information to the XenServer dom0. Failure to do so will give the message "XenServer Tools not installed". This package allows NetBSD to interface with XenServer to enable: - Memory usage logging - IP address reporting - Suspend/Resume - Migration - OS version reporting This version is for XenServer 6.0 and earlier.
Diffstat (limited to 'sysutils/xe-guest-utilities')
-rw-r--r--sysutils/xe-guest-utilities/DESCR12
-rw-r--r--sysutils/xe-guest-utilities/MESSAGE10
-rw-r--r--sysutils/xe-guest-utilities/Makefile56
-rw-r--r--sysutils/xe-guest-utilities/PLIST4
-rw-r--r--sysutils/xe-guest-utilities/distinfo7
-rwxr-xr-xsysutils/xe-guest-utilities/files/xenguest.sh62
-rw-r--r--sysutils/xe-guest-utilities/patches/patch-xe-daemon25
-rw-r--r--sysutils/xe-guest-utilities/patches/patch-xe-update-guest-attrs177
8 files changed, 353 insertions, 0 deletions
diff --git a/sysutils/xe-guest-utilities/DESCR b/sysutils/xe-guest-utilities/DESCR
new file mode 100644
index 00000000000..d317d015b13
--- /dev/null
+++ b/sysutils/xe-guest-utilities/DESCR
@@ -0,0 +1,12 @@
+NetBSD can run as a paravirtualised guest of Citrix XenServer using
+XEN3PAE_DOMU (i386) or XEN3_DOMU (amd64) kernels. To get full
+functionality, guest VMs must provide run-time information to the
+XenServer dom0. Failure to do so will give the message "XenServer
+Tools not installed".
+
+This package allows NetBSD to interface with XenServer to enable:
+- Memory usage logging
+- IP address reporting
+- Suspend/Resume
+- Migration
+- OS version reporting
diff --git a/sysutils/xe-guest-utilities/MESSAGE b/sysutils/xe-guest-utilities/MESSAGE
new file mode 100644
index 00000000000..0a5d57e7a7d
--- /dev/null
+++ b/sysutils/xe-guest-utilities/MESSAGE
@@ -0,0 +1,10 @@
+===========================================================================
+$NetBSD: MESSAGE,v 1.1.1.1 2011/10/03 16:57:03 sborrill Exp $
+
+These tools are only useful when NetBSD is running as a paravirtualised
+guest within XenServer.
+
+Your domU kernel must provide /kern/xen/xenbus. Support was added to NetBSD
+HEAD and netbsd-5 source trees on 23rd September 2011.
+
+===========================================================================
diff --git a/sysutils/xe-guest-utilities/Makefile b/sysutils/xe-guest-utilities/Makefile
new file mode 100644
index 00000000000..2215af4585d
--- /dev/null
+++ b/sysutils/xe-guest-utilities/Makefile
@@ -0,0 +1,56 @@
+# $NetBSD: Makefile,v 1.1.1.1 2011/10/03 16:57:03 sborrill Exp $
+#
+
+# Values from XenServer 6.0 = 6, 0, 0, 50560
+# Values from XenServer 5.6 SP2 = 5, 6, 100, 39153
+XENMAJOR= 6
+XENMINOR= 0
+XENTEENY= 0
+XENBUILD= 50560
+
+VERSION= ${XENMAJOR}.${XENMINOR}.${XENTEENY}
+DISTNAME= xe-guest-utilities_5.6.0-595
+CATEGORIES= sysutils
+PKGNAME= xe-guest-utilities-${VERSION}
+MASTER_SITES= http://updates.vmd.citrix.com/XenServer/5.6.0/debian/pool/main/x/xe-guest-utilities/
+
+MAINTAINER= sborrill@NetBSD.org
+HOMEPAGE= http://www.xenserver.com/
+COMMENT= NetBSD VM tools for Citrix XenServer
+LICENSE= gnu-gpl-v2
+
+DEPENDS+= xenstoretools:../../sysutils/xenstoretools
+
+PKG_DESTDIR_SUPPORT= user-destdir
+
+ONLY_FOR_PLATFORM+= NetBSD-[5-9].*-x86_64 NetBSD-[5-9].*-i386
+
+WRKSRC= ${WRKDIR}/${DISTNAME:C/-[0-9]+$$//:C/_/-/}
+
+SRCFILES= xe-daemon xe-update-guest-attrs
+
+NO_CONFIGURE= yes
+NO_BUILD= yes
+
+RCD_SCRIPTS= xenguest
+SUBST_CLASSES+= paths
+SUBST_STAGE.paths= post-patch
+SUBST_FILES.paths= ${SRCFILES}
+SUBST_SED.paths= -e "s,@VARBASE@,${VARBASE},g" -e "s,@PREFIX@,${PREFIX},g"
+
+SUBST_CLASSES+= version
+SUBST_STAGE.version= post-patch
+SUBST_FILES.version= xe-update-guest-attrs
+SUBST_SED.version= -e "s,@XENMAJOR@,${XENMAJOR},g" \
+ -e "s,@XENMINOR@,${XENMINOR},g" \
+ -e "s,@XENTEENY@,${XENTEENY},g" \
+ -e "s,@XENBUILD@,${XENBUILD},g"
+
+INSTALLATION_DIRS= sbin
+
+do-install:
+ for file in ${SRCFILES}; do \
+ ${INSTALL_SCRIPT} ${WRKSRC}/$${file} ${DESTDIR}${PREFIX}/sbin/$${file}; \
+ done
+
+.include "../../mk/bsd.pkg.mk"
diff --git a/sysutils/xe-guest-utilities/PLIST b/sysutils/xe-guest-utilities/PLIST
new file mode 100644
index 00000000000..91bf5481060
--- /dev/null
+++ b/sysutils/xe-guest-utilities/PLIST
@@ -0,0 +1,4 @@
+@comment $NetBSD: PLIST,v 1.1.1.1 2011/10/03 16:57:03 sborrill Exp $
+sbin/xe-daemon
+sbin/xe-update-guest-attrs
+share/examples/rc.d/xenguest
diff --git a/sysutils/xe-guest-utilities/distinfo b/sysutils/xe-guest-utilities/distinfo
new file mode 100644
index 00000000000..be057668f17
--- /dev/null
+++ b/sysutils/xe-guest-utilities/distinfo
@@ -0,0 +1,7 @@
+$NetBSD: distinfo,v 1.1.1.1 2011/10/03 16:57:03 sborrill Exp $
+
+SHA1 (xe-guest-utilities_5.6.0-595.tar.gz) = 7373f2cc37ba3761ee92051513e09787371eb77e
+RMD160 (xe-guest-utilities_5.6.0-595.tar.gz) = f526fd9ae1b47f22860915aba825ddd440b445b8
+Size (xe-guest-utilities_5.6.0-595.tar.gz) = 454235 bytes
+SHA1 (patch-xe-daemon) = 3107fa2e018d66a2ca37b1c2a748c65aa1be3e2f
+SHA1 (patch-xe-update-guest-attrs) = 0d30c8a8567d489a831c1063383ba67476efa4db
diff --git a/sysutils/xe-guest-utilities/files/xenguest.sh b/sysutils/xe-guest-utilities/files/xenguest.sh
new file mode 100755
index 00000000000..a4dcb3a76d3
--- /dev/null
+++ b/sysutils/xe-guest-utilities/files/xenguest.sh
@@ -0,0 +1,62 @@
+#!@RCD_SCRIPTS_SHELL@
+#
+# $NetBSD: xenguest.sh,v 1.1.1.1 2011/10/03 16:57:03 sborrill Exp $
+#
+# PROVIDE: xenguest
+# REQUIRE: DAEMON
+
+$_rc_subr_loaded . /etc/rc.subr
+
+name="xenguest"
+rcvar=$name
+command="@PREFIX@/sbin/xe-daemon"
+start_cmd="xenguest_start"
+start_precmd="xenguest_precmd"
+xenbus_path="/kern/xen/xenbus"
+pidfile="/var/run/xe-daemon.pid"
+command_args="-p $pidfile"
+command_interpreter="/bin/sh"
+
+xenguest_precmd()
+{
+ XE_LINUX_DISTRIBUTION_CACHE=@VARBASE@/cache/xe-linux-distribution
+
+ if [ ! -f ${xenbus_path} ]; then
+ echo "${name}: Cannot find ${xenbus_path}!"
+ exit 1
+ fi
+ if [ ! -x @PREFIX@/bin/xenstore-read ]; then
+ echo "${name}: xenstore tools not found."
+ exit 1
+ fi
+ domid=$(@PREFIX@/bin/xenstore-read domid)
+ if [ "$domid" = 0 ]; then
+ echo "${name}: Do not run on dom0, this is for domU use only."
+ exit 1
+ fi
+ if [ ! -f $XE_LINUX_DISTRIBUTION_CACHE ]; then
+ os_distro="$(uname -s)"
+ os_uname="$(uname -r)"
+ os_name="$(uname -s) $(uname -r)"
+ os_majorver="${os_uname%%.*}"
+ os_minorver="${os_uname#*.}"
+ os_minorver="${os_minorver%%.*}"
+
+ cat << EOF > $XE_LINUX_DISTRIBUTION_CACHE
+os_distro="$os_distro"
+os_uname="$os_uname"
+os_name="$os_name"
+os_majorver="$os_majorver"
+os_minorver="$os_minorver"
+EOF
+ fi
+}
+
+xenguest_start()
+{
+ @ECHO@ "Starting ${name}."
+ $command $command_args &
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/sysutils/xe-guest-utilities/patches/patch-xe-daemon b/sysutils/xe-guest-utilities/patches/patch-xe-daemon
new file mode 100644
index 00000000000..0fefff7d345
--- /dev/null
+++ b/sysutils/xe-guest-utilities/patches/patch-xe-daemon
@@ -0,0 +1,25 @@
+$NetBSD: patch-xe-daemon,v 1.1.1.1 2011/10/03 16:57:03 sborrill Exp $
+
+--- xe-daemon.orig 2011-09-23 15:39:33.000000000 +0100
++++ xe-daemon 2011-09-23 15:42:48.000000000 +0100
+@@ -1,4 +1,4 @@
+-#!/bin/bash
++#!/bin/sh
+
+ # Copyright (C) 2009 Citrix Systems Inc.
+ #
+@@ -42,12 +42,12 @@
+ esac
+ done
+
+-XE_UPDATE_GUEST_ATTRS=${XE_UPDATE_GUEST_ATTRS:-/usr/sbin/xe-update-guest-attrs}
++XE_UPDATE_GUEST_ATTRS=${XE_UPDATE_GUEST_ATTRS:-@PREFIX@/sbin/xe-update-guest-attrs}
+ XE_DAEMON_RATE=${XE_DAEMON_RATE:-60} # run once a minute by default
+ XE_MEMORY_UPDATE_DIVISOR=${XE_MEMORY_UPDATE_DIVISOR:-2} # update mem stats 1/2 as often by dflt
+
+ # Delete xenstore cache following each reboot
+-rm -rf /var/cache/xenstore
++rm -rf @VARBASE@/cache/xenstore
+
+ MEMORY_UPDATE_COUNTER=0
+ while true ; do
diff --git a/sysutils/xe-guest-utilities/patches/patch-xe-update-guest-attrs b/sysutils/xe-guest-utilities/patches/patch-xe-update-guest-attrs
new file mode 100644
index 00000000000..f2911faa5c1
--- /dev/null
+++ b/sysutils/xe-guest-utilities/patches/patch-xe-update-guest-attrs
@@ -0,0 +1,177 @@
+$NetBSD: patch-xe-update-guest-attrs,v 1.1.1.1 2011/10/03 16:57:03 sborrill Exp $
+
+--- xe-update-guest-attrs.orig 2011-09-23 15:39:33.000000000 +0100
++++ xe-update-guest-attrs 2011-09-23 15:44:30.000000000 +0100
+@@ -35,11 +35,11 @@
+ export LANG
+
+
+-XE_LINUX_DISTRIBUTION_CACHE=/var/cache/xe-linux-distribution
++XE_LINUX_DISTRIBUTION_CACHE=@VARBASE@/cache/xe-linux-distribution
+
+ IPADDR_RE="\([[:digit:]]\{1,3\}\.\)\{3\}[[:digit:]]\{1,3\}"
+
+-export PATH=/usr/sbin:/usr/bin:/sbin:/bin
++export PATH=/usr/sbin:/usr/bin:/sbin:/bin:@PREFIX@/sbin:@PREFIX@/bin
+ XENSTORE=${XENSTORE:-xenstore}
+
+ XENSTORE_UPDATED=0
+@@ -56,7 +56,7 @@
+
+ xenstore_write_cached() {
+ key="$1" newval="$2"
+- cache=/var/cache/xenstore/$key
++ cache=@VARBASE@/cache/xenstore/$key
+ if [ -f $cache ] ; then
+ # cache exists
+ oldval=$(cat "$cache")
+@@ -84,13 +84,13 @@
+
+ # If we detect a domain change then delete our cache and force a refresh
+ domid=$(xenstore-read "domid")
+-cache=/var/cache/xenstore/unique-domain-id
++cache=@VARBASE@/cache/xenstore/unique-domain-id
+ newval=$(xenstore-read "/local/domain/${domid}/unique-domain-id")
+ if [ -e $cache ]; then
+ oldval=$(cat "$cache")
+ if [ "$oldval" != "$newval" ]; then
+ # domain changed
+- rm -rf /var/cache/xenstore
++ rm -rf @VARBASE@/cache/xenstore
+ fi
+ fi
+ mkdir -p $(dirname "$cache")
+@@ -98,7 +98,7 @@
+
+ xenstore_rm_cached() {
+ key="$1"
+- cache=/var/cache/xenstore/$key
++ cache=@VARBASE@/cache/xenstore/$key
+ if [ ! -e $cache ] ; then
+ return 1
+ fi
+@@ -112,7 +112,7 @@
+ }
+
+ xenstore_list_interfaces_cached() {
+- topdir=/var/cache/xenstore/attr
++ topdir=@VARBASE@/cache/xenstore/attr
+ if [ -d $topdir ] ; then
+ cd $topdir
+ for dir in * ; do
+@@ -133,49 +133,45 @@
+
+
+
+-# e.g.
+-# $ ip addr show
+-# 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue
+-# link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
+-# inet 127.0.0.1/8 scope host lo
+-# inet6 ::1/128 scope host
+-# valid_lft forever preferred_lft forever
+-# 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
+-# link/ether 00:13:20:95:e8:74 brd ff:ff:ff:ff:ff:ff
+-# inet 172.31.0.57/20 brd 172.31.15.255 scope global eth0
+-# inet6 fe80::213:20ff:fe95:e874/64 scope link
+-# valid_lft forever preferred_lft forever
+-# 3: sit0: <NOARP> mtu 1480 qdisc noop
+-# link/sit 0.0.0.0 brd 0.0.0.0
+-
+-#eval $(ip addr show | \
+-# sed -n -e 's/^[[:digit:]]*: \([a-z0-9]*\): .*/ifs="\$ifs \1"; current="\1"; /gp;' \
+-# -e 's/^[[:space:]]\{4\}inet \('${IPADDR_RE}'\)\/.*/eval inet_\${current}="\1"; /gp;')
+-
+-# e.g.
+-# eth0 Link encap:Ethernet HWaddr 00:13:20:95:E8:74
+-# inet addr:172.31.0.57 Bcast:172.31.15.255 Mask:255.255.240.0
+-# inet6 addr: fe80::213:20ff:fe95:e874/64 Scope:Link
+-# UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
+-# RX packets:98001128 errors:0 dropped:0 overruns:0 frame:0
+-# TX packets:87728920 errors:0 dropped:0 overruns:0 carrier:0
+-# collisions:0 txqueuelen:1000
+-# RX bytes:35864034092 (33.4 GiB) TX bytes:27544025180 (25.6 GiB)
+-# Interrupt:177
+-#
+-# lo Link encap:Local Loopback
+-# inet addr:127.0.0.1 Mask:255.0.0.0
+-# inet6 addr: ::1/128 Scope:Host
+-# UP LOOPBACK RUNNING MTU:16436 Metric:1
+-# RX packets:32928 errors:0 dropped:0 overruns:0 frame:0
+-# TX packets:32928 errors:0 dropped:0 overruns:0 carrier:0
+-# collisions:0 txqueuelen:0
+-# RX bytes:3604609 (3.4 MiB) TX bytes:3604609 (3.4 MiB)
+-
+-eval $(/sbin/ifconfig | \
+- sed -n -e '/^[0-9a-z][0-9a-z]*\:/,/^$/d' \
+- -e 's/^\([0-9a-z][0-9a-z]*\) .*/ifs="\$ifs \1"; current="\1"; /gp;' \
+- -e 's/ *inet addr:\('$IPADDR_RE'\) .*/eval inet_\${current}="\1"; /gp;')
++#xennet0: flags=8863<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST> mtu 1500
++# capabilities=2800<TCP4CSUM_Tx,UDP4CSUM_Tx>
++# enabled=0
++# address: 0e:7e:86:20:7b:82
++# inet 192.168.1.109 netmask 0xffffff00 broadcast 192.168.1.255
++# inet6 fe80::c7e:86ff:fe20:7b82%xennet0 prefixlen 64 scopeid 0x1
++#lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 33184
++# inet 127.0.0.1 netmask 0xff000000
++# inet6 ::1 prefixlen 128
++# inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2
++
++#/sbin/ifconfig | \
++# sed -n -e '/^[0-9a-z][0-9a-z]*\:/,/^$/d' \
++# -e 's/^\([0-9a-z][0-9a-z]*\) .*/ifs="\$ifs \1"; current="\1"; /gp;' \
++# -e 's/ *inet \('$IPADDR_RE'\) .*/eval inet_\${current}="\1"; /gp;'
++
++eval $(/sbin/ifconfig -a | \
++ awk '{
++ if ($0~"^[a-z][a-z0-9]*[0-9]:") {
++ if ($0~"^xennet[0-9]+:") {
++ current = $1
++ sub(":.*", "", current)
++ sub("xennet", "eth", current)
++ iflist = iflist " " current
++ } else {
++ current =""
++ }
++ }
++ if ($1 == "inet" && current != "") {
++ ifs[current] = $2
++ current = ""
++ }
++ }
++ END {
++ sub("^ ", "", iflist)
++ printf "ifs=%c%s%c\n", 39, iflist, 39
++ for (i in ifs)
++ printf "inet_%s=%s\n", i, ifs[i]
++ }')
+
+ # network
+ for if in $ifs ; do
+@@ -206,16 +202,18 @@
+ fi
+
+ # whether I support ballooning or not
+-xenstore_write_cached "control/feature-balloon" "1"
+-
+-# whether I support ballooning or not
+-xenstore_write_cached "control/feature-balloon" "1"
++sysctl -n machdep.xen.balloon.current 2>/dev/null
++if [ "$?" = 0 ]; then
++ xenstore_write_cached "control/feature-balloon" "1"
++else
++ xenstore_write_cached "control/feature-balloon" "0"
++fi
+
+ # build time addons
+-xenstore_write_cached "attr/PVAddons/MajorVersion" "5"
+-xenstore_write_cached "attr/PVAddons/MinorVersion" "6"
+-xenstore_write_cached "attr/PVAddons/MicroVersion" "0"
+-xenstore_write_cached "attr/PVAddons/BuildVersion" "39674"
++xenstore_write_cached "attr/PVAddons/MajorVersion" "@XENMAJOR@"
++xenstore_write_cached "attr/PVAddons/MinorVersion" "@XENMINOR@"
++xenstore_write_cached "attr/PVAddons/MicroVersion" "@XENTEENY@"
++xenstore_write_cached "attr/PVAddons/BuildVersion" "@XENBUILD@"
+ xenstore_write_cached "attr/PVAddons/Installed" "1"
+
+ # update xenstore if necc