Merge "XenAPI: Fix another race condition"
This commit is contained in:
commit
77aca755b1
@ -119,9 +119,7 @@ script
|
|||||||
|
|
||||||
chown -R $STACK_USER /opt/stack
|
chown -R $STACK_USER /opt/stack
|
||||||
|
|
||||||
if su -c "/opt/stack/run.sh" $STACK_USER; then
|
su -c "/opt/stack/run.sh" $STACK_USER
|
||||||
touch /var/run/devstack.succeeded
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Update /etc/issue
|
# Update /etc/issue
|
||||||
{
|
{
|
||||||
@ -177,8 +175,19 @@ fi
|
|||||||
cat <<EOF >$STAGING_DIR/opt/stack/run.sh
|
cat <<EOF >$STAGING_DIR/opt/stack/run.sh
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -eux
|
set -eux
|
||||||
|
(
|
||||||
|
flock -n 9 || exit 1
|
||||||
|
|
||||||
|
[ -e /opt/stack/runsh.succeeded ] && rm /opt/stack/runsh.succeeded
|
||||||
|
echo \$\$ >> /opt/stack/run_sh.pid
|
||||||
|
|
||||||
cd /opt/stack/devstack
|
cd /opt/stack/devstack
|
||||||
./unstack.sh || true
|
./unstack.sh || true
|
||||||
./stack.sh
|
./stack.sh
|
||||||
|
|
||||||
|
# Got to the end - success
|
||||||
|
touch /opt/stack/runsh.succeeded
|
||||||
|
rm /opt/stack/run_sh.pid
|
||||||
|
) 9> /opt/stack/.runsh_lock
|
||||||
EOF
|
EOF
|
||||||
chmod 755 $STAGING_DIR/opt/stack/run.sh
|
chmod 755 $STAGING_DIR/opt/stack/run.sh
|
||||||
|
@ -365,8 +365,8 @@ COPYENV=${COPYENV:-1}
|
|||||||
if [ "$WAIT_TILL_LAUNCH" = "1" ] && [ -e ~/.ssh/id_rsa.pub ] && [ "$COPYENV" = "1" ]; then
|
if [ "$WAIT_TILL_LAUNCH" = "1" ] && [ -e ~/.ssh/id_rsa.pub ] && [ "$COPYENV" = "1" ]; then
|
||||||
set +x
|
set +x
|
||||||
|
|
||||||
echo "VM Launched - Waiting for devstack to start"
|
echo "VM Launched - Waiting for run.sh"
|
||||||
while ! ssh_no_check -q stack@$OS_VM_MANAGEMENT_ADDRESS "service devstack status | grep -q running"; do
|
while ! ssh_no_check -q stack@$OS_VM_MANAGEMENT_ADDRESS "test -e /opt/stack/run_sh.pid"; do
|
||||||
sleep 10
|
sleep 10
|
||||||
done
|
done
|
||||||
echo -n "devstack service is running, waiting for stack.sh to start logging..."
|
echo -n "devstack service is running, waiting for stack.sh to start logging..."
|
||||||
@ -376,14 +376,11 @@ if [ "$WAIT_TILL_LAUNCH" = "1" ] && [ -e ~/.ssh/id_rsa.pub ] && [ "$COPYENV" =
|
|||||||
done
|
done
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
# Watch devstack's output (which doesn't start until stack.sh is running,
|
pid=`ssh_no_check -q stack@$OS_VM_MANAGEMENT_ADDRESS "cat /opt/stack/run_sh.pid"`
|
||||||
# but wait for run.sh (which starts stack.sh) to exit as that is what
|
|
||||||
# hopefully writes the succeeded cookie.
|
|
||||||
pid=`ssh_no_check -q stack@$OS_VM_MANAGEMENT_ADDRESS pgrep run.sh`
|
|
||||||
ssh_no_check -q stack@$OS_VM_MANAGEMENT_ADDRESS "tail --pid $pid -n +1 -f /tmp/devstack/log/stack.log"
|
ssh_no_check -q stack@$OS_VM_MANAGEMENT_ADDRESS "tail --pid $pid -n +1 -f /tmp/devstack/log/stack.log"
|
||||||
|
|
||||||
# Fail if devstack did not succeed
|
# Fail if devstack did not succeed
|
||||||
ssh_no_check -q stack@$OS_VM_MANAGEMENT_ADDRESS 'test -e /var/run/devstack.succeeded'
|
ssh_no_check -q stack@$OS_VM_MANAGEMENT_ADDRESS 'test -e /opt/stack/runsh.succeeded'
|
||||||
|
|
||||||
set +x
|
set +x
|
||||||
echo "################################################################################"
|
echo "################################################################################"
|
||||||
@ -401,7 +398,7 @@ else
|
|||||||
echo ""
|
echo ""
|
||||||
echo "ssh into your domU now: 'ssh stack@$OS_VM_MANAGEMENT_ADDRESS' using your password"
|
echo "ssh into your domU now: 'ssh stack@$OS_VM_MANAGEMENT_ADDRESS' using your password"
|
||||||
echo "and then do: 'sudo service devstack status' to check if devstack is still running."
|
echo "and then do: 'sudo service devstack status' to check if devstack is still running."
|
||||||
echo "Check that /var/run/devstack.succeeded exists"
|
echo "Check that /opt/stack/runsh.succeeded exists"
|
||||||
echo ""
|
echo ""
|
||||||
echo "When devstack completes, you can visit the OpenStack Dashboard"
|
echo "When devstack completes, you can visit the OpenStack Dashboard"
|
||||||
echo "at http://$OS_VM_SERVICES_ADDRESS, and contact other services at the usual ports."
|
echo "at http://$OS_VM_SERVICES_ADDRESS, and contact other services at the usual ports."
|
||||||
|
Loading…
Reference in New Issue
Block a user