new Xen 3.1 ebuilds

This commit is contained in:
Micha Glave
2007-05-30 14:00:19 +00:00
parent 25f5ff49a0
commit 511f38854c
17 changed files with 633 additions and 10 deletions

View File

@@ -0,0 +1,3 @@
MD5 b7ae1f652b071862ae4c90b72d549627 xen-3.1.0-src.tgz 6831094
RMD160 2fd65a3b81e522d0ed2d62fd11e5977167f1ceb3 xen-3.1.0-src.tgz 6831094
SHA256 b5d7cea6deeee1439e8883fed4b3f1a8e4f675b4af8148178721f99bd76676b7 xen-3.1.0-src.tgz 6831094

View File

@@ -0,0 +1,22 @@
--- xen-3.1.0-src/tools/misc/xen-python-path 2007-05-18 16:45:21.000000000 +0200
+++ xen-3.1.0-src/tools/misc/xen-python-path.new 2007-05-21 14:24:56.000000000 +0200
@@ -30,12 +30,13 @@
for p in ['python%s' % sys.version[:3], 'python']:
for l in ['/usr/lib64', '/usr/lib']:
- d = os.path.join(l, p)
- if os.path.exists(os.path.join(d, AUXBIN)):
- sys.path.append(d)
- import xen.util.auxbin
- print os.path.join(xen.util.auxbin.libpath(), p)
- sys.exit(0)
+ for k in ['', 'site-packages/']:
+ d = os.path.join(l, p, k)
+ if os.path.exists(os.path.join(d, AUXBIN)):
+ sys.path.append(d)
+ import xen.util.auxbin
+ print os.path.join(xen.util.auxbin.libpath(), p)
+ sys.exit(0)
print >>sys.stderr, "Cannot find Xen Python modules."
sys.exit(1)

View File

@@ -0,0 +1,5 @@
/var/log/xen-consoles/*.log {
rotate 7
missingok
compress
}

View File

@@ -0,0 +1,42 @@
#!/sbin/runscript
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-emulation/xen-tools/files/xend-init,v 1.1 2006/03/24 23:55:01 agriffis Exp $
opts="start stop status restart"
depend() {
need net
before xendomains sshd ntpd nfs nfsmount rsyncd portmap dhcp
}
await_daemons_up() {
for ((i=0; i<5; i++)); do
sleep 1
/usr/sbin/xend status && return 0
done
return 1
}
start() {
ebegin "Starting Xen control daemon"
/usr/sbin/xend start
/usr/sbin/xend status || await_daemons_up
eend $?
}
stop() {
if [ "$(xm list | wc -l)" -gt 2 ]; then
ebegin " Stopping all domains"
/usr/sbin/xm shutdown --all --wait >/dev/null
eend $?
fi
ebegin "Stopping Xen control daemon"
/usr/sbin/xend stop
eend $?
}
status() {
/usr/sbin/xend status
}

View File

@@ -0,0 +1,61 @@
#!/sbin/runscript
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-emulation/xen-tools/files/xend.initd,v 1.1 2007/05/02 04:10:04 marineam Exp $
opts="start stop status restart"
depend() {
need net
before xendomains sshd ntp-client ntpd nfs nfsmount rsyncd portmap dhcp
}
await_daemons_up() {
for ((i=0; i<5; i++)); do
sleep 1
/usr/sbin/xend status && return 0
done
return 1
}
is_privileged_domain() {
grep -qsE '^control_d$' /proc/xen/capabilities
return $?
}
start() {
if is_privileged_domain ; then
ebegin "Starting Xen control daemon"
/usr/sbin/xend start
/usr/sbin/xend status || await_daemons_up
eend $?
else
eerror "Can't start xend - this is not a privileged domain."
return 1
fi
}
stop() {
if [ "$(xm list | wc -l)" -gt 2 ]; then
ebegin " Stopping all domains"
/usr/sbin/xm shutdown --all --wait >/dev/null
eend $?
fi
ebegin "Stopping Xen control daemon"
/usr/sbin/xend stop
eend $?
# This needs more testing (bug #149321)
#ebegin "Stopping xenconsoled"
#kill $(</var/run/xenconsoled.pid)
#eend $?
#ebegin "Stopping xenstored"
#kill $(</var/run/xenstore.pid)
#eend $?
}
status() {
is_privileged_domain && /usr/sbin/xend status
}

View File

@@ -0,0 +1,15 @@
# When SCREEN="yes", domains in AUTODIR have their consoles connected to a
# screen session named SCREEN_NAME, with output logged to individual files
# named after each domain and written to /var/log/xen-consoles/ . These files
# are rotated (using app-admin/logrotate) every time xendomains is started.
SCREEN="yes"
SCREEN_NAME="xen"
# Number of seconds between writes to screen's logfiles.
#
# Lower values mean more disk activity and hence a possible performance
# impact, but higher values mean a greater chance of loosing some output
# in the event of a crash.
SCREEN_LOG_INTERVAL="1"

View File

@@ -0,0 +1,7 @@
# /etc/conf.d/xendomains
# Directory of domains to boot. AUTODIR should contain one or more symlinks
# to domain config files in /etc/xen
AUTODIR=/etc/xen/auto

View File

@@ -0,0 +1,96 @@
#!/sbin/runscript
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-emulation/xen-tools/files/xendomains.initd,v 1.2 2007/05/02 04:10:04 marineam Exp $
opts="start stop status restart"
depend() {
need xend
after dhcp
}
get_domname() {
local name_from_file=$(sed -rn 's/^name\W*=\W*\"?([[:alnum:]_\.-]+)\"?\W*;?/\1/p' "${1}" | tail -n 1)
if [[ -z ${name_from_file} ]] ; then
basename "${1}"
else
echo ${name_from_file}
fi
}
is_running() {
/usr/sbin/xm list "${1}" >/dev/null 2>&1
}
using_screen() {
[[ "${SCREEN}" == "yes" || "${SCREEN}" == "YES" ]]
}
set_screen_cmd() {
screen_cmd="screen -q -r ${SCREEN_NAME:=xen} -X"
}
start() {
set_screen_cmd
einfo "Starting Xen domains from ${AUTODIR:=/etc/xen/auto}"
if using_screen ; then
ebegin "Creating screen session to hold domain consoles"
( screen -d -m -S ${SCREEN_NAME} -t dom0 \
&& ${screen_cmd} zombie dr \
&& logrotate -f /etc/xen/xen-consoles.logrotate \
&& ${screen_cmd} logfile /var/log/xen-consoles/%t.log \
&& ${screen_cmd} logfile flush ${SCREEN_LOG_INTERVAL:-1} \
&& ${screen_cmd} log on \
&& ${screen_cmd} deflog on ) >/dev/null
if [[ $? -ne 0 ]] ; then
eend 1
return 1
else
eend
fi
fi
# Create all domains with config files in AUTODIR.
for dom in $(ls "${AUTODIR}/"* 2>/dev/null); do
name=$(get_domname ${dom})
if ! is_running ${name} ; then
ebegin " Starting domain ${name}"
if using_screen ; then
${screen_cmd} screen -t ${name} xm create ${dom} -c
else
xm create --quiet ${dom}
fi
eend $?
else
einfo " Not starting domain ${name} - already running"
fi
done
}
stop() {
set_screen_cmd
einfo "Shutting down Xen domains from ${AUTODIR:=/etc/xen/auto}"
# Stop all domains with config files in AUTODIR.
for dom in $(ls "${AUTODIR}/"* 2>/dev/null); do
name=$(get_domname ${dom})
if is_running ${name} ; then
ebegin " Stopping domain ${name}"
xm shutdown --wait ${name} >/dev/null
eend $?
else
einfo " Not stopping domain ${name} - not running"
fi
done
if using_screen ; then
ebegin "Closing screen session ${SCREEN_NAME}"
${screen_cmd} quit
eend $?
fi
}
status() {
/usr/sbin/xm list
}