diff options
Diffstat (limited to 'main/xen/xend.initd')
-rw-r--r-- | main/xen/xend.initd | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/main/xen/xend.initd b/main/xen/xend.initd index ee26c3f331..398ecd86b9 100644 --- a/main/xen/xend.initd +++ b/main/xen/xend.initd @@ -1,38 +1,53 @@ #!/sbin/runscript depend() { - need net xencommons - before xendomains sshd ntp-client ntpd nfs nfsmount rsyncd portmap dhcp + need xencommons + before xendomains } -is_privileged_domain() { - grep -qsE '^control_d$' /proc/xen/capabilities - return $? +await_daemons_up() { + i=1 + rets=10 + /usr/sbin/xend status + while [ $? -ne 0 -a $i -lt $rets ]; do + sleep 1 + i=$(($i + 1)) + /usr/sbin/xend status + done } start() { - if is_privileged_domain ; then - ebegin "Starting Xen daemons" - /usr/sbin/xend start - eend $? + ebegin "Starting Xen daemons" + if [ -z "`ps xenconsoled -o pid=`" ]; then + eend 1 + echo "xencommons should be started first." + exit 1 + fi + mkdir -p /var/lock + if [ -d /var/lock/subsys ]; then + touch /var/lock/subsys/xend else - eerror "Can't start xend - not a privileged domain" - return 1 + touch /var/lock/xend fi + /usr/sbin/xend start + await_daemons_up + eend $? } stop() { ebegin "Stopping Xen control daemon" /usr/sbin/xend stop + rm -f /var/lock/subsys/xend /var/lock/xend eend $? } restart() { ebegin "Restarting Xen control daemon" /usr/sbin/xend restart + await_daemons_up eend $? } status() { - is_privileged_domain && /usr/sbin/xend status + /usr/sbin/xend status } |