Skip to content

Commit 9b6a4bc

Browse files
Jenkinsopenstack-gerrit
authored andcommitted
Merge "Improvements to DevStack's XenServer scripts"
2 parents d3dde55 + daadf74 commit 9b6a4bc

File tree

12 files changed

+453
-208
lines changed

12 files changed

+453
-208
lines changed

tools/xen/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,9 @@ Step 5: Do cloudy stuff!
8181
* Play with horizon
8282
* Play with the CLI
8383
* Log bugs to devstack and core projects, and submit fixes!
84+
85+
Step 6: Run from snapshot
86+
-------------------------
87+
If you want to quicky re-run devstack from a clean state,
88+
using the same settings you used in your previous run,
89+
you can revert the DomU to the snapshot called "before_first_boot"

tools/xen/build_xva.sh

Lines changed: 33 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,40 @@
11
#!/bin/bash
22

3-
set -e
4-
5-
declare -a on_exit_hooks
6-
7-
on_exit()
8-
{
9-
for i in $(seq $((${#on_exit_hooks[*]} - 1)) -1 0)
10-
do
11-
eval "${on_exit_hooks[$i]}"
12-
done
13-
}
14-
15-
add_on_exit()
16-
{
17-
local n=${#on_exit_hooks[*]}
18-
on_exit_hooks[$n]="$*"
19-
if [[ $n -eq 0 ]]
20-
then
21-
trap on_exit EXIT
22-
fi
23-
}
24-
25-
# Abort if localrc is not set
26-
if [ ! -e ../../localrc ]; then
27-
echo "You must have a localrc with ALL necessary passwords defined before proceeding."
28-
echo "See the xen README for required passwords."
29-
exit 1
30-
fi
3+
# This script is run by install_os_domU.sh
4+
#
5+
# It modifies the ubuntu image created by install_os_domU.sh
6+
# and previously moodified by prepare_guest_template.sh
7+
#
8+
# This script is responsible for:
9+
# - pushing in the DevStack code
10+
# - creating run.sh, to run the code on boot
11+
# It does this by mounting the disk image of the VM.
12+
#
13+
# The resultant image is then templated and started
14+
# by install_os_domU.sh
15+
16+
# Exit on errors
17+
set -o errexit
18+
# Echo commands
19+
set -o xtrace
3120

3221
# This directory
3322
TOP_DIR=$(cd $(dirname "$0") && pwd)
3423

24+
# Include onexit commands
25+
. $TOP_DIR/scripts/on_exit.sh
26+
3527
# Source params - override xenrc params in your localrc to suite your taste
3628
source xenrc
3729

38-
# Echo commands
39-
set -o xtrace
40-
30+
#
31+
# Parameters
32+
#
4133
GUEST_NAME="$1"
4234

43-
# Directory where we stage the build
35+
#
36+
# Mount the VDI
37+
#
4438
STAGING_DIR=$($TOP_DIR/scripts/manage-vdi open $GUEST_NAME 0 1 | grep -o "/tmp/tmp.[[:alnum:]]*")
4539
add_on_exit "$TOP_DIR/scripts/manage-vdi close $GUEST_NAME 0 1"
4640

@@ -76,7 +70,7 @@ cd $TOP_DIR
7670
cat <<EOF >$STAGING_DIR/etc/rc.local
7771
# network restart required for getting the right gateway
7872
/etc/init.d/networking restart
79-
GUEST_PASSWORD=$GUEST_PASSWORD STAGING_DIR=/ DO_TGZ=0 bash /opt/stack/devstack/tools/xen/prepare_guest.sh > /opt/stack/prepare_guest.log 2>&1
73+
chown -R stack /opt/stack
8074
su -c "/opt/stack/run.sh > /opt/stack/run.sh.log 2>&1" stack
8175
exit 0
8276
EOF
@@ -85,8 +79,12 @@ EOF
8579
echo $GUEST_NAME > $STAGING_DIR/etc/hostname
8680

8781
# Hostname must resolve for rabbit
82+
HOSTS_FILE_IP=$PUB_IP
83+
if [ $MGT_IP != "dhcp" ]; then
84+
HOSTS_FILE_IP=$MGT_IP
85+
fi
8886
cat <<EOF >$STAGING_DIR/etc/hosts
89-
$MGT_IP $GUEST_NAME
87+
$HOSTS_FILE_IP $GUEST_NAME
9088
127.0.0.1 localhost localhost.localdomain
9189
EOF
9290

@@ -142,8 +140,6 @@ cat <<EOF >$STAGING_DIR/opt/stack/run.sh
142140
#!/bin/bash
143141
cd /opt/stack/devstack
144142
killall screen
145-
UPLOAD_LEGACY_TTY=yes HOST_IP=$PUB_IP VIRT_DRIVER=xenserver FORCE=yes MULTI_HOST=$MULTI_HOST HOST_IP_IFACE=$HOST_IP_IFACE $STACKSH_PARAMS ./stack.sh
143+
VIRT_DRIVER=xenserver FORCE=yes MULTI_HOST=$MULTI_HOST HOST_IP_IFACE=$HOST_IP_IFACE $STACKSH_PARAMS ./stack.sh
146144
EOF
147145
chmod 755 $STAGING_DIR/opt/stack/run.sh
148-
149-
echo "Done"

tools/xen/install_domU_multi.sh

Lines changed: 0 additions & 40 deletions
This file was deleted.

0 commit comments

Comments
 (0)