Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F133341594
D28551.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D28551.id.diff
View Options
Index: sysutils/xen-tools/Makefile
===================================================================
--- sysutils/xen-tools/Makefile
+++ sysutils/xen-tools/Makefile
@@ -22,8 +22,8 @@
RUN_DEPENDS= seabios>0:misc/seabios
DOCS_BUILD_DEPENDS=markdown:textproc/markdown
+USE_RC_SUBR= xendomains
OPTIONS_DEFINE= DOCS SPICE
-OPTIONS_DEFAULT= DOCS
OPTIONS_SUB= yes
SPICE_DESC= Enable SPICE protocol for QEMU
Index: sysutils/xen-tools/files/xendomains.in
===================================================================
--- sysutils/xen-tools/files/xendomains.in
+++ sysutils/xen-tools/files/xendomains.in
@@ -0,0 +1,77 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: xendomains
+# REQUIRE: FILESYSTEMS xencommons
+
+. /etc/rc.subr
+
+name="xendomains"
+desc="Manage Xen Domains"
+rcvar="xendomains_enable"
+
+start_cmd="xendomains_start"
+stop_cmd="xendomains_stop"
+status_cmd="xendomains_status"
+extra_commands="status"
+: ${xendomains_cmd:=/usr/local/sbin/xl}
+: ${xendomains_dir:=/usr/local/etc/xen/auto}
+: ${xen_shutdown_wait:=30}
+: ${xen_destroy_wait:=60}
+
+xendomains_status()
+{
+ ${xendomains_cmd} list | awk '
+ (FNR <= 2) { next }
+ ($5 !~ /s/) { s = s " " $1 }
+ END { sub(" *", "", s); print s }' | tr ' ' '\n'
+}
+
+xendomains_start()
+{
+ echo 'Starting Xen Domains'
+ for domain in ${xendomains_dir}/* ; do
+ ${xendomains_cmd} create ${domain}
+ done
+}
+
+xendomains_stop()
+{
+ echo 'Stopping Xen Domains'
+
+ xendomains_status | while read domain ; do
+ echo Stopping Xen domain ${domain}
+ ${xendomains_cmd} shutdown -F ${domain}
+ done
+
+ echo "Waiting ${xen_shutdown_wait} seconds for Xen Domain poweroff"
+ sleep ${xen_shutdown_wait}
+
+ if [ $( xendomains_status | wc -l ) -gt 1 ] ; then
+ echo 'Powering off remaining Xen Domains'
+ xendomains_status | while read domain ; do
+ echo Stopping Xen domain ${domain}
+ ${xendomains_cmd} shutdown -F ${domain}
+ done
+ fi
+
+ if [ $( xendomains_status | wc -l ) -gt 1 ] ; then
+ echo "Waiting ${xen_destroy_wait} seconds for Xen Domain destruction"
+ sleep ${xen_destroy_wait}
+ if [ $( xendomains_status | wc -l ) -gt 1 ] ; then
+ xendomains_status | while read domain ; do
+ echo Destroying Xen domain ${domain}
+ ${xendomains_cmd} destroy ${domain}
+ done
+ fi
+ fi
+
+ if [ $( xendomains_status | wc -l ) -gt 1 ] ; then
+ echo 'The following Xen Domains could not be destroyed:'
+ xendomains_status
+ fi
+}
+
+run_rc_command "$1"
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Oct 26, 1:31 AM (14 h, 30 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
24204301
Default Alt Text
D28551.id.diff (2 KB)
Attached To
Mode
D28551: xendomains rc script for xen-tools to allow automatic guest start/stop
Attached
Detach File
Event Timeline
Log In to Comment