summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Ross <aross@gentoo.org>2006-08-14 07:11:47 +0000
committerAndrew Ross <aross@gentoo.org>2006-08-14 07:11:47 +0000
commit31f8ec4fc952113e6a2d8adba7ad98e54e282a53 (patch)
treeedb16b5f7480fb42d033fd6b77187ceccbd281cb /app-emulation/xen-tools/files
parentold (diff)
downloadhistorical-31f8ec4fc952113e6a2d8adba7ad98e54e282a53.tar.gz
historical-31f8ec4fc952113e6a2d8adba7ad98e54e282a53.tar.bz2
historical-31f8ec4fc952113e6a2d8adba7ad98e54e282a53.zip
Fix bugs #141981, #142011, #141866, and #137886.
Package-Manager: portage-2.1-r2
Diffstat (limited to 'app-emulation/xen-tools/files')
-rw-r--r--app-emulation/xen-tools/files/digest-xen-tools-3.0.2-r33
-rw-r--r--app-emulation/xen-tools/files/xen-consoles.logrotate5
-rw-r--r--app-emulation/xen-tools/files/xendomains-screen.confd15
-rw-r--r--app-emulation/xen-tools/files/xendomains.confd7
-rwxr-xr-xapp-emulation/xen-tools/files/xendomains.initd96
5 files changed, 126 insertions, 0 deletions
diff --git a/app-emulation/xen-tools/files/digest-xen-tools-3.0.2-r3 b/app-emulation/xen-tools/files/digest-xen-tools-3.0.2-r3
new file mode 100644
index 000000000000..724d092d5489
--- /dev/null
+++ b/app-emulation/xen-tools/files/digest-xen-tools-3.0.2-r3
@@ -0,0 +1,3 @@
+MD5 544eab940a0734a55459d648e5c3b224 xen-3.0.2-src.tgz 4933621
+RMD160 34e4431a981891319f8a5ea0c3f604e7d8d7d7af xen-3.0.2-src.tgz 4933621
+SHA256 f18ffab16a457fa721d11933c75f8288f6958c88c2669857c7c11d5107ba2951 xen-3.0.2-src.tgz 4933621
diff --git a/app-emulation/xen-tools/files/xen-consoles.logrotate b/app-emulation/xen-tools/files/xen-consoles.logrotate
new file mode 100644
index 000000000000..c6445239b42f
--- /dev/null
+++ b/app-emulation/xen-tools/files/xen-consoles.logrotate
@@ -0,0 +1,5 @@
+/var/log/xen-consoles/*.log {
+ rotate 7
+ missingok
+ compress
+}
diff --git a/app-emulation/xen-tools/files/xendomains-screen.confd b/app-emulation/xen-tools/files/xendomains-screen.confd
new file mode 100644
index 000000000000..1482c0a25041
--- /dev/null
+++ b/app-emulation/xen-tools/files/xendomains-screen.confd
@@ -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"
diff --git a/app-emulation/xen-tools/files/xendomains.confd b/app-emulation/xen-tools/files/xendomains.confd
new file mode 100644
index 000000000000..f1d810d6ce4f
--- /dev/null
+++ b/app-emulation/xen-tools/files/xendomains.confd
@@ -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
+
diff --git a/app-emulation/xen-tools/files/xendomains.initd b/app-emulation/xen-tools/files/xendomains.initd
new file mode 100755
index 000000000000..15a263a3e9ff
--- /dev/null
+++ b/app-emulation/xen-tools/files/xendomains.initd
@@ -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.1 2006/08/14 07:11:47 aross Exp $
+
+opts="start stop status restart"
+
+depend() {
+ need xend
+ after dhcp
+}
+
+get_domname() {
+ local name_from_file=$(sed -rn 's/^name\W*=\W*\"?([[:alpha:]_]+)\"?\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
+}