mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 02:30:03 +01:00
Instead of trying to read xenstore via xenstore-read use the pidfile of xenstored for the test whether xenstored is running. This prepares support of xenstore domain, as trying to read xenstore will block for ever in case xenstore domain is started after trying to read. Signed-off-by: Juergen Gross <jgross@suse.com> Acked-by: Wei Liu <wei.liu2@citrix.com>
66 lines
1.6 KiB
Bash
66 lines
1.6 KiB
Bash
#!/bin/bash
|
|
#
|
|
# Copyright (c) 2016 SUSE Linux GmbH
|
|
#
|
|
# This library is free software; you can redistribute it and/or
|
|
# modify it under the terms of version 2.1 of the GNU Lesser General Public
|
|
# License as published by the Free Software Foundation.
|
|
#
|
|
# This library is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
# Lesser General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU Lesser General Public
|
|
# License along with this library; If not, see <http://www.gnu.org/licenses/>.
|
|
#
|
|
|
|
XENSTORED=@XENSTORED@
|
|
|
|
. @XEN_SCRIPT_DIR@/hotplugpath.sh
|
|
|
|
test_xenstore () {
|
|
test -f @XEN_RUN_DIR@/xenstored.pid
|
|
return $?
|
|
}
|
|
|
|
timeout_xenstore () {
|
|
local time=0
|
|
local timeout=30
|
|
|
|
while [ $time -lt $timeout ] && ! test_xenstore ; do
|
|
echo -n .
|
|
time=$(($time+1))
|
|
sleep 1
|
|
done
|
|
echo
|
|
|
|
# Exit if we timed out
|
|
if ! [ $time -lt $timeout ] ; then
|
|
echo "Could not start $@"
|
|
return 1
|
|
fi
|
|
|
|
return 0
|
|
}
|
|
|
|
test_xenstore && exit 0
|
|
|
|
test -f @CONFIG_DIR@/@CONFIG_LEAF_DIR@/xencommons && . @CONFIG_DIR@/@CONFIG_LEAF_DIR@/xencommons
|
|
|
|
test -z "$XENSTORED_ROOTDIR" && XENSTORED_ROOTDIR="@XEN_LIB_STORED@"
|
|
rm -f "$XENSTORED_ROOTDIR"/tdb* &>/dev/null
|
|
test -z "$XENSTORED_TRACE" || XENSTORED_ARGS=" -T @XEN_LOG_DIR@/xenstored-trace.log"
|
|
|
|
if [ -n "$XENSTORED" ] ; then
|
|
echo -n Starting $XENSTORED...
|
|
$XENSTORED --pid-file @XEN_RUN_DIR@/xenstored.pid $XENSTORED_ARGS
|
|
else
|
|
echo "No xenstored found"
|
|
exit 1
|
|
fi
|
|
|
|
timeout_xenstore $XENSTORED || exit 1
|
|
|
|
exit 0
|