Skip to content

Commit

Permalink
CP-9795: Split xenservices initscript
Browse files Browse the repository at this point in the history
Run one service per init script, splitting xenservices into xenstored
and xenconsoled since this is handled better by systemd.

Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
  • Loading branch information
rosslagerwall committed Dec 4, 2014
1 parent dcf4691 commit cbb41f2
Show file tree
Hide file tree
Showing 5 changed files with 170 additions and 104 deletions.
3 changes: 2 additions & 1 deletion scripts/OMakefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ install:
$(IPROG) rio.db.conf.skel $(DESTDIR)$(ETCDIR)/db.conf.rio
mkdir -p $(DESTDIR)/etc/init.d
mkdir -p $(DESTDIR)/etc/rc.d/init.d
$(IPROG) init.d-xenservices $(DESTDIR)/etc/rc.d/init.d/xenservices
$(IPROG) init.d-xenstored $(DESTDIR)/etc/rc.d/init.d/xenstored
$(IPROG) init.d-xenconsoled $(DESTDIR)/etc/rc.d/init.d/xenconsoled
$(IPROG) init.d-xapi $(DESTDIR)/etc/rc.d/init.d/xapi
$(IPROG) init.d-xapissl $(DESTDIR)$(LIBEXECDIR)/xapissl
$(IPROG) init.d-xapi-domains $(DESTDIR)/etc/rc.d/init.d/xapi-domains
Expand Down
74 changes: 74 additions & 0 deletions scripts/init.d-xenconsoled
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#! /bin/bash
#
# xapi Start/Stop xenconsoled
#
# chkconfig: 2345 22 78
# description: Xenconsoled
# processname: xenconsoled
# config: @ETCDIR@/rio.conf
# pidfile: /var/run/xenconsoled.pid

[ -e /proc/xen ] || exit 0

# Source function library.
. /etc/init.d/functions

start() {
echo -n $"Starting xenconsoled: "
if [ -e /var/lock/subsys/xen ]; then
if [ -e /var/run/xenconsoled.pid ] && [ -e /proc/`cat /var/run/xenconsoled.pid` ]; then
echo -n $"cannot start xenconsoled: xenconsoled is already running.";
failure $"cannot start xenconsoled: xenconsoled already running.";
echo
return 1
fi
fi

OLD_ULIMIT_N=$(ulimit -n)
ulimit -n 4096
/usr/sbin/xenconsoled --log=hv --timestamp=hv --log-dir=/var/log/xen --pid-file=/var/run/xenconsoled.pid
ulimit -n $OLD_ULIMIT_N

echo
touch /var/lock/subsys/xen;
return $RETVAL
}

stop() {
echo -n $"Action not supported"
failure $"Action not supported"
echo
return 1;
}

rhstatus() {
status xapi
}

restart() {
echo -n $"Action not supported"
failure $"Action not supported"
echo
return 1;
}

case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
status)
rhstatus
;;
condrestart)
[ -f /var/lock/subsys/xapi ] && restart || :
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart}"
exit 1
esac
101 changes: 0 additions & 101 deletions scripts/init.d-xenservices

This file was deleted.

90 changes: 90 additions & 0 deletions scripts/init.d-xenstored
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
#! /bin/bash
#
# xapi Start/Stop xenstored
#
# chkconfig: 2345 21 78
# description: Xenstored
# processname: xenstored
# config: @ETCDIR@/rio.conf
# pidfile: /var/run/xenstored.pid

[ -e /proc/xen ] || exit 0

# Source function library.
. /etc/init.d/functions

start() {
echo -n $"Starting xenstored: "
if [ -e /var/lock/subsys/xen ]; then
if [ -e /var/run/xenstored.pid ] && [ -e /proc/`cat /var/run/xenstored.pid` ]; then
echo -n $"cannot start xenstored: xenstored is already running.";
failure $"cannot start xenstored: xenstored already running.";
echo
return 1
fi
fi

# Existence of stampfile suppresses the access log (oem)
XENSTORED_ARG="--pid-file /var/run/xenstored.pid"
[ ! -e @ETCDIR@/xenstored-no-access-log ] || XENSTORED_ARG="--no-access-log"
[ -e /var/lib/xenstored/tdb ] && mv -f /var/lib/xenstored/tdb /var/lib/xenstored/tdb.bak
"@BINDIR@/xenstored" ${XENSTORED_ARG}

[ -d /var/log/blktap ] || mkdir /var/log/blktap

# Delete rubbish from xapi's private tree in xenstore, once per boot (not once per
# xapi invocation since the data should be persistent across xapi restarts)
xenstore-rm /xapi

# Delete any accumulated /vm entries, once per boot
xenstore-rm /vm

# start cdrommon on all physicals cdrom at startup
if [ -d /dev/xapi/cd ]; then
for i in `find /dev/xapi/cd/ ! -type d`; do "@LIBEXECDIR@/cdrommon" $i; done
else
logger "No physical CDROM devices detected; not starting cdrommon"
fi
echo
touch /var/lock/subsys/xen;
return $RETVAL
}

stop() {
echo -n $"Action not supported"
failure $"Action not supported"
echo
return 1;
}

rhstatus() {
status xapi
}

restart() {
echo -n $"Action not supported"
failure $"Action not supported"
echo
return 1;
}

case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
status)
rhstatus
;;
condrestart)
[ -f /var/lock/subsys/xapi ] && restart || :
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart}"
exit 1
esac
6 changes: 4 additions & 2 deletions xapi.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ rm -rf $RPM_BUILD_ROOT

%post core
[ ! -x /sbin/chkconfig ] || chkconfig --add xapi
[ ! -x /sbin/chkconfig ] || chkconfig --add xenservices
[ ! -x /sbin/chkconfig ] || chkconfig --add xenstored
[ ! -x /sbin/chkconfig ] || chkconfig --add xenconsoled
[ ! -x /sbin/chkconfig ] || chkconfig --add xapi-domains
[ ! -x /sbin/chkconfig ] || chkconfig --add perfmon
[ ! -x /sbin/chkconfig ] || chkconfig --add genptoken
Expand All @@ -128,7 +129,8 @@ rm -rf $RPM_BUILD_ROOT
/etc/rc.d/init.d/xapi
/etc/rc.d/init.d/xapi-domains
@OPTDIR@/libexec/xapissl
/etc/rc.d/init.d/xenservices
/etc/rc.d/init.d/xenstored
/etc/rc.d/init.d/xenconsoled
/etc/rc.d/init.d/genptoken
%config(noreplace) /etc/sysconfig/perfmon
%config(noreplace) /etc/sysconfig/xapi
Expand Down

0 comments on commit cbb41f2

Please sign in to comment.