Xen: support Ubuntu Xenial for xen DevStack

Upgrade xen tool to install Ubuntu Xenial; change the upstart
task to systemd task to finish the OpenStack installation
by using devstack.

Change-Id: I8129923be3c41e7f60e9d32348a5ea8e07d4845b
This commit is contained in:
Jianghua Wang 2017-02-22 11:42:22 +08:00
parent 7a30c7fcab
commit 6e49cab091
4 changed files with 39 additions and 41 deletions

View File

@ -96,48 +96,27 @@ 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
# Create an upstart job (task) for devstack, which can interact with the console # Create an systemd task for devstack
cat >$STAGING_DIR/etc/init/devstack.conf << EOF cat >$STAGING_DIR/etc/systemd/system/devstack.service << EOF
start on stopped rc RUNLEVEL=[2345] [Unit]
Description=Install OpenStack by DevStack
console output [Service]
task Type=oneshot
RemainAfterExit=yes
ExecStartPre=/bin/rm -f /opt/stack/runsh.succeeded
ExecStart=/bin/su -c "/opt/stack/run.sh" stack
StandardOutput=tty
StandardError=tty
pre-start script [Install]
rm -f /opt/stack/runsh.succeeded WantedBy=multi-user.target
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
su -c "/opt/stack/run.sh" $STACK_USER
# Update /etc/issue
{
echo "OpenStack VM - Installed by DevStack"
IPADDR=\$(ip -4 address show eth0 | sed -n 's/.*inet \\([0-9\.]\\+\\).*/\1/p')
echo " Management IP: \$IPADDR"
echo -n " Devstack run: "
if [ -e /opt/stack/runsh.succeeded ]; then
echo "SUCCEEDED"
else
echo "FAILED"
fi
echo ""
} > /etc/issue
initctl start hvc0 > /dev/null 2>&1
end script
EOF EOF
# enable this service
ln -s $STAGING_DIR/etc/systemd/system/devstack.service $STAGING_DIR/etc/systemd/system/multi-user.target.wants/devstack.service
# Configure the hostname # Configure the hostname
echo $GUEST_NAME > $STAGING_DIR/etc/hostname echo $GUEST_NAME > $STAGING_DIR/etc/hostname
@ -178,6 +157,8 @@ set -eux
( (
flock -n 9 || exit 1 flock -n 9 || exit 1
sudo chown -R stack /opt/stack
[ -e /opt/stack/runsh.succeeded ] && rm /opt/stack/runsh.succeeded [ -e /opt/stack/runsh.succeeded ] && rm /opt/stack/runsh.succeeded
echo \$\$ >> /opt/stack/run_sh.pid echo \$\$ >> /opt/stack/run_sh.pid
@ -187,7 +168,24 @@ set -eux
# Got to the end - success # Got to the end - success
touch /opt/stack/runsh.succeeded touch /opt/stack/runsh.succeeded
# Update /etc/issue
(
echo "OpenStack VM - Installed by DevStack"
IPADDR=$(ip -4 address show eth0 | sed -n 's/.*inet \([0-9\.]\+\).*/\1/p')
echo " Management IP: $IPADDR"
echo -n " Devstack run: "
if [ -e /opt/stack/runsh.succeeded ]; then
echo "SUCCEEDED"
else
echo "FAILED"
fi
echo ""
) > /opt/stack/issue
sudo cp /opt/stack/issue /etc/issue
rm /opt/stack/run_sh.pid rm /opt/stack/run_sh.pid
) 9> /opt/stack/.runsh_lock ) 9> /opt/stack/.runsh_lock
EOF EOF
chmod 755 $STAGING_DIR/opt/stack/run.sh chmod 755 $STAGING_DIR/opt/stack/run.sh

View File

@ -424,7 +424,7 @@ else
echo "looking at the console of your domU / checking the log files." 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: 'sudo service devstack status' to check if devstack is still running." echo "and then do: 'sudo systemctl status devstack' to check if devstack is still running."
echo "Check that /opt/stack/runsh.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"

View File

@ -50,7 +50,7 @@ disk_size=$(($OSDOMU_VDI_GB * 1024 * 1024 * 1024))
# however these need to be answered before the netinstall # however these need to be answered before the netinstall
# is ready to fetch the preseed file, and as such must be here # is ready to fetch the preseed file, and as such must be here
# to get a fully automated install # to get a fully automated install
pvargs="-- quiet console=hvc0 partman/default_filesystem=ext3 \ pvargs="quiet console=hvc0 partman/default_filesystem=ext3 \
console-setup/ask_detect=false locale=${UBUNTU_INST_LOCALE} \ console-setup/ask_detect=false locale=${UBUNTU_INST_LOCALE} \
keyboard-configuration/layoutcode=${UBUNTU_INST_KEYBOARD} \ keyboard-configuration/layoutcode=${UBUNTU_INST_KEYBOARD} \
netcfg/choose_interface=eth0 \ netcfg/choose_interface=eth0 \

View File

@ -63,8 +63,8 @@ PUB_IP=${PUB_IP:-172.24.4.10}
PUB_NETMASK=${PUB_NETMASK:-255.255.255.0} PUB_NETMASK=${PUB_NETMASK:-255.255.255.0}
# Ubuntu install settings # Ubuntu install settings
UBUNTU_INST_RELEASE="trusty" UBUNTU_INST_RELEASE="xenial"
UBUNTU_INST_TEMPLATE_NAME="Ubuntu 14.04 (64-bit) for DevStack" UBUNTU_INST_TEMPLATE_NAME="Ubuntu 16.04 (64-bit) for DevStack"
# For 12.04 use "precise" and update template name # For 12.04 use "precise" and update template name
# However, for 12.04, you should be using # However, for 12.04, you should be using
# XenServer 6.1 and later or XCP 1.6 or later # XenServer 6.1 and later or XCP 1.6 or later