Merge "xenapi: enable user interaction with stack.sh"

This commit is contained in:
Jenkins 2013-12-05 02:30:36 +00:00 committed by Gerrit Code Review
commit e9ca36b3d9
2 changed files with 41 additions and 23 deletions

View File

@ -93,13 +93,34 @@ mkdir -p $STAGING_DIR/opt/stack/devstack
tar xf /tmp/devstack.tar -C $STAGING_DIR/opt/stack/devstack tar xf /tmp/devstack.tar -C $STAGING_DIR/opt/stack/devstack
cd $TOP_DIR cd $TOP_DIR
# Run devstack on launch # Create an upstart job (task) for devstack, which can interact with the console
cat <<EOF >$STAGING_DIR/etc/rc.local cat >$STAGING_DIR/etc/init/devstack.conf << EOF
# network restart required for getting the right gateway start on stopped rc RUNLEVEL=[2345]
/etc/init.d/networking restart
chown -R $STACK_USER /opt/stack console output
su -c "/opt/stack/run.sh > /opt/stack/run.sh.log" $STACK_USER task
exit 0
pre-start script
rm -f /var/run/devstack.succeeded
end script
script
initctl stop hvc0 || true
# Read any leftover characters from standard input
while read -n 1 -s -t 0.1 -r ignored; do
true
done
clear
chown -R $STACK_USER /opt/stack
if su -c "/opt/stack/run.sh" $STACK_USER; then
touch /var/run/devstack.succeeded
fi
initctl start hvc0 > /dev/null 2>&1
end script
EOF EOF
# Configure the hostname # Configure the hostname
@ -138,8 +159,9 @@ fi
# Configure run.sh # Configure run.sh
cat <<EOF >$STAGING_DIR/opt/stack/run.sh cat <<EOF >$STAGING_DIR/opt/stack/run.sh
#!/bin/bash #!/bin/bash
set -eux
cd /opt/stack/devstack cd /opt/stack/devstack
killall screen ./unstack.sh || true
VIRT_DRIVER=xenserver FORCE=yes MULTI_HOST=$MULTI_HOST HOST_IP_IFACE=$HOST_IP_IFACE $STACKSH_PARAMS ./stack.sh ./stack.sh
EOF EOF
chmod 755 $STAGING_DIR/opt/stack/run.sh chmod 755 $STAGING_DIR/opt/stack/run.sh

View File

@ -367,25 +367,20 @@ 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 startup script" echo "VM Launched - Waiting for devstack to start"
# wait for log to appear 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 "[ -e run.sh.log ]"; do
sleep 10 sleep 10
done done
echo -n "Running" echo -n "devstack is running"
while [ `ssh_no_check -q stack@$OS_VM_MANAGEMENT_ADDRESS pgrep -c run.sh` -ge 1 ] while ssh_no_check -q stack@$OS_VM_MANAGEMENT_ADDRESS "service devstack status | grep -q running"; do
do
sleep 10 sleep 10
echo -n "." echo -n "."
done done
echo "done!" echo "done!"
set -x set -x
# output the run.sh.log # Fail if devstack did not succeed
ssh_no_check -q stack@$OS_VM_MANAGEMENT_ADDRESS 'cat run.sh.log' ssh_no_check -q stack@$OS_VM_MANAGEMENT_ADDRESS 'test -e /var/run/devstack.succeeded'
# Fail if the expected text is not found
ssh_no_check -q stack@$OS_VM_MANAGEMENT_ADDRESS 'cat run.sh.log' | grep -q 'stack.sh completed in'
set +x set +x
echo "################################################################################" echo "################################################################################"
@ -399,11 +394,12 @@ else
echo "" echo ""
echo "All Finished!" echo "All Finished!"
echo "Now, you can monitor the progress of the stack.sh installation by " echo "Now, you can monitor the progress of the stack.sh installation by "
echo "tailing /opt/stack/run.sh.log from within your domU." echo "looking at the console of your domU / checking the log files."
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: 'tail -f /opt/stack/run.sh.log'" echo "and then do: 'sudo service devstack status' to check if devstack is still running."
echo "Check that /var/run/devstack.succeeded exists"
echo "" echo ""
echo "When the script completes, you can then 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."
fi fi