This is a partial fix for bug 1009937
Change-Id: I1fc7059cd812bce1539a5050f60717db4cbd81ef
| ... | ... |
@@ -44,19 +44,14 @@ if [ ! -d $STAGING_DIR/etc ]; then |
| 44 | 44 |
exit 1 |
| 45 | 45 |
fi |
| 46 | 46 |
|
| 47 |
-# Directory where our conf files are stored |
|
| 48 |
-FILES_DIR=$TOP_DIR/files |
|
| 49 |
-TEMPLATES_DIR=$TOP_DIR/templates |
|
| 50 |
- |
|
| 51 |
-# Directory for supporting script files |
|
| 52 |
-SCRIPT_DIR=$TOP_DIR/scripts |
|
| 53 |
- |
|
| 54 |
-# Version of ubuntu with which we are working |
|
| 55 |
-UBUNTU_VERSION=`cat $STAGING_DIR/etc/lsb-release | grep "DISTRIB_CODENAME=" | sed "s/DISTRIB_CODENAME=//"` |
|
| 56 |
-KERNEL_VERSION=`ls $STAGING_DIR/boot/vmlinuz* | head -1 | sed "s/.*vmlinuz-//"` |
|
| 57 |
- |
|
| 58 | 47 |
# Configure dns (use same dns as dom0) |
| 59 |
-cp /etc/resolv.conf $STAGING_DIR/etc/resolv.conf |
|
| 48 |
+# but only when not precise |
|
| 49 |
+if [ "$UBUNTU_INST_RELEASE" != "precise" ]; then |
|
| 50 |
+ cp /etc/resolv.conf $STAGING_DIR/etc/resolv.conf |
|
| 51 |
+elif [ "$MGT_IP" != "dhcp" ] && [ "$PUB_IP" != "dhcp" ]; then |
|
| 52 |
+ echo "Configuration without DHCP not supported on Precise" |
|
| 53 |
+ exit 1 |
|
| 54 |
+fi |
|
| 60 | 55 |
|
| 61 | 56 |
# Copy over devstack |
| 62 | 57 |
rm -f /tmp/devstack.tar |
| ... | ... |
@@ -90,6 +85,7 @@ EOF |
| 90 | 90 |
|
| 91 | 91 |
# Configure the network |
| 92 | 92 |
INTERFACES=$STAGING_DIR/etc/network/interfaces |
| 93 |
+TEMPLATES_DIR=$TOP_DIR/templates |
|
| 93 | 94 |
cp $TEMPLATES_DIR/interfaces.in $INTERFACES |
| 94 | 95 |
if [ $VM_IP == "dhcp" ]; then |
| 95 | 96 |
echo 'eth1 on dhcp' |
| ... | ... |
@@ -169,7 +169,7 @@ fi |
| 169 | 169 |
HOST_IP=${HOST_IP:-`ifconfig xenbr0 | grep "inet addr" | cut -d ":" -f2 | sed "s/ .*//"`}
|
| 170 | 170 |
|
| 171 | 171 |
# Set up ip forwarding, but skip on xcp-xapi |
| 172 |
-if [ -a /etc/sysconfig/network]; then |
|
| 172 |
+if [ -a /etc/sysconfig/network ]; then |
|
| 173 | 173 |
if ! grep -q "FORWARD_IPV4=YES" /etc/sysconfig/network; then |
| 174 | 174 |
# FIXME: This doesn't work on reboot! |
| 175 | 175 |
echo "FORWARD_IPV4=YES" >> /etc/sysconfig/network |
| ... | ... |
@@ -218,7 +218,7 @@ fi |
| 218 | 218 |
# |
| 219 | 219 |
|
| 220 | 220 |
GUEST_NAME=${GUEST_NAME:-"DevStackOSDomU"}
|
| 221 |
-TNAME="devstack_template_folsom_11.10" |
|
| 221 |
+TNAME="devstack_template" |
|
| 222 | 222 |
SNAME_PREPARED="template_prepared" |
| 223 | 223 |
SNAME_FIRST_BOOT="before_first_boot" |
| 224 | 224 |
|
| ... | ... |
@@ -242,19 +242,6 @@ if [ -z "$templateuuid" ]; then |
| 242 | 242 |
# Install Ubuntu over network |
| 243 | 243 |
# |
| 244 | 244 |
|
| 245 |
- # try to find ubuntu template |
|
| 246 |
- ubuntu_template_name="Ubuntu 11.10 for DevStack (64-bit)" |
|
| 247 |
- ubuntu_template=$(xe_min template-list name-label="$ubuntu_template_name") |
|
| 248 |
- |
|
| 249 |
- # remove template, if we are in CLEAN_TEMPLATE mode |
|
| 250 |
- if [ -n "$ubuntu_template" ]; then |
|
| 251 |
- if $CLEAN_TEMPLATES; then |
|
| 252 |
- xe template-param-clear param-name=other-config uuid=$ubuntu_template |
|
| 253 |
- xe template-uninstall template-uuid=$ubuntu_template force=true |
|
| 254 |
- ubuntu_template="" |
|
| 255 |
- fi |
|
| 256 |
- fi |
|
| 257 |
- |
|
| 258 | 245 |
# always update the preseed file, incase we have a newer one |
| 259 | 246 |
PRESEED_URL=${PRESEED_URL:-""}
|
| 260 | 247 |
if [ -z "$PRESEED_URL" ]; then |
| ... | ... |
@@ -272,13 +259,12 @@ if [ -z "$templateuuid" ]; then |
| 272 | 272 |
fi |
| 273 | 273 |
fi |
| 274 | 274 |
|
| 275 |
- if [ -z "$ubuntu_template" ]; then |
|
| 276 |
- $TOP_DIR/scripts/xenoneirictemplate.sh $PRESEED_URL |
|
| 277 |
- fi |
|
| 275 |
+ # Update the template |
|
| 276 |
+ $TOP_DIR/scripts/install_ubuntu_template.sh $PRESEED_URL |
|
| 278 | 277 |
|
| 279 | 278 |
# create a new VM with the given template |
| 280 | 279 |
# creating the correct VIFs and metadata |
| 281 |
- $TOP_DIR/scripts/install-os-vpx.sh -t "$ubuntu_template_name" -v $VM_BR -m $MGT_BR -p $PUB_BR -l $GUEST_NAME -r $OSDOMU_MEM_MB -k "flat_network_bridge=${VM_BR}"
|
|
| 280 |
+ $TOP_DIR/scripts/install-os-vpx.sh -t "$UBUNTU_INST_TEMPLATE_NAME" -v $VM_BR -m $MGT_BR -p $PUB_BR -l $GUEST_NAME -r $OSDOMU_MEM_MB -k "flat_network_bridge=${VM_BR}"
|
|
| 282 | 281 |
|
| 283 | 282 |
# wait for install to finish |
| 284 | 283 |
wait_for_VM_to_halt |
| 285 | 284 |
new file mode 100755 |
| ... | ... |
@@ -0,0 +1,78 @@ |
| 0 |
+#!/bin/bash |
|
| 1 |
+# |
|
| 2 |
+# This creates an Ubuntu Server 32bit or 64bit template |
|
| 3 |
+# on Xenserver 5.6.x, 6.0.x and 6.1.x |
|
| 4 |
+# The template does a net install only |
|
| 5 |
+# |
|
| 6 |
+# Based on a script by: David Markey <david.markey@citrix.com> |
|
| 7 |
+# |
|
| 8 |
+ |
|
| 9 |
+# Exit on errors |
|
| 10 |
+set -o errexit |
|
| 11 |
+# Echo commands |
|
| 12 |
+set -o xtrace |
|
| 13 |
+ |
|
| 14 |
+# This directory |
|
| 15 |
+BASE_DIR=$(cd $(dirname "$0") && pwd) |
|
| 16 |
+ |
|
| 17 |
+# For default setings see xenrc |
|
| 18 |
+source $BASE_DIR/../xenrc |
|
| 19 |
+ |
|
| 20 |
+# Get the params |
|
| 21 |
+preseed_url=$1 |
|
| 22 |
+ |
|
| 23 |
+# Delete template or skip template creation as required |
|
| 24 |
+previous_template=$(xe template-list name-label="$UBUNTU_INST_TEMPLATE_NAME" \ |
|
| 25 |
+ params=uuid --minimal) |
|
| 26 |
+if [ -n "$previous_template" ]; then |
|
| 27 |
+ if $CLEAN_TEMPLATES; then |
|
| 28 |
+ xe template-param-clear param-name=other-config uuid=$previous_template |
|
| 29 |
+ xe template-uninstall template-uuid=$previous_template force=true |
|
| 30 |
+ else |
|
| 31 |
+ echo "Template $UBUNTU_INST_TEMPLATE_NAME already present" |
|
| 32 |
+ exit 0 |
|
| 33 |
+ fi |
|
| 34 |
+fi |
|
| 35 |
+ |
|
| 36 |
+# Get built-in template |
|
| 37 |
+builtin_name="Debian Squeeze 6.0 (32-bit)" |
|
| 38 |
+builtin_uuid=$(xe template-list name-label="$builtin_name" --minimal) |
|
| 39 |
+if [[ -z $builtin_uuid ]]; then |
|
| 40 |
+ echo "Cant find the Debian Squeeze 32bit template on your XenServer." |
|
| 41 |
+ exit 1 |
|
| 42 |
+fi |
|
| 43 |
+ |
|
| 44 |
+# Clone built-in template to create new template |
|
| 45 |
+new_uuid=$(xe vm-clone uuid=$builtin_uuid \ |
|
| 46 |
+ new-name-label="$UBUNTU_INST_TEMPLATE_NAME") |
|
| 47 |
+ |
|
| 48 |
+# Some of these settings can be found in example preseed files |
|
| 49 |
+# however these need to be answered before the netinstall |
|
| 50 |
+# is ready to fetch the preseed file, and as such must be here |
|
| 51 |
+# to get a fully automated install |
|
| 52 |
+pvargs="-- quiet console=hvc0 partman/default_filesystem=ext3 \ |
|
| 53 |
+console-setup/ask_detect=false locale=${UBUNTU_INST_LOCALE} \
|
|
| 54 |
+keyboard-configuration/layoutcode=${UBUNTU_INST_KEYBOARD} \
|
|
| 55 |
+netcfg/choose_interface=${HOST_IP_IFACE} \
|
|
| 56 |
+netcfg/get_hostname=os netcfg/get_domain=os auto \ |
|
| 57 |
+url=${preseed_url}"
|
|
| 58 |
+ |
|
| 59 |
+if [ "$NETINSTALLIP" != "dhcp" ]; then |
|
| 60 |
+ netcfgargs="netcfg/disable_autoconfig=true \ |
|
| 61 |
+netcfg/get_nameservers=${UBUNTU_INST_NAMESERVERS} \
|
|
| 62 |
+netcfg/get_ipaddress=${UBUNTU_INST_IP} \
|
|
| 63 |
+netcfg/get_netmask=${UBUNTU_INST_NETMASK} \
|
|
| 64 |
+netcfg/get_gateway=${UBUNTU_INST_GATEWAY} \
|
|
| 65 |
+netcfg/confirm_static=true" |
|
| 66 |
+ pvargs="${pvargs} ${netcfgargs}"
|
|
| 67 |
+fi |
|
| 68 |
+ |
|
| 69 |
+xe template-param-set uuid=$new_uuid \ |
|
| 70 |
+ other-config:install-methods=http \ |
|
| 71 |
+ other-config:install-repository="$UBUNTU_INST_REPOSITORY" \ |
|
| 72 |
+ PV-args="$pvargs" \ |
|
| 73 |
+ other-config:debian-release="$UBUNTU_INST_RELEASE" \ |
|
| 74 |
+ other-config:default_template=true \ |
|
| 75 |
+ other-config:install-arch="$UBUNTU_INST_ARCH" |
|
| 76 |
+ |
|
| 77 |
+echo "Ubuntu template installed uuid:$new_uuid" |
| 0 | 78 |
deleted file mode 100755 |
| ... | ... |
@@ -1,63 +0,0 @@ |
| 1 |
-#!/bin/bash |
|
| 2 |
-## makeubuntu.sh, this creates Ubuntu server 11.10 32 and 64 bit templates |
|
| 3 |
-## on Xenserver 6.0.2 Net install only |
|
| 4 |
-## Original Author: David Markey <david.markey@citrix.com> |
|
| 5 |
-## Author: Renuka Apte <renuka.apte@citrix.com> |
|
| 6 |
-## This is not an officially supported guest OS on XenServer 6.0.2 |
|
| 7 |
- |
|
| 8 |
-BASE_DIR=$(cd $(dirname "$0") && pwd) |
|
| 9 |
-source $BASE_DIR/../../../localrc |
|
| 10 |
- |
|
| 11 |
-LENNY=$(xe template-list name-label=Debian\ Squeeze\ 6.0\ \(32-bit\) --minimal) |
|
| 12 |
- |
|
| 13 |
-if [[ -z $LENNY ]] ; then |
|
| 14 |
- echo "Cant find Squeeze 32bit template." |
|
| 15 |
- exit 1 |
|
| 16 |
-fi |
|
| 17 |
- |
|
| 18 |
-distro="Ubuntu 11.10 for DevStack" |
|
| 19 |
-arches=("32-bit" "64-bit")
|
|
| 20 |
- |
|
| 21 |
-preseedurl=${1:-"http://images.ansolabs.com/devstackubuntupreseed.cfg"}
|
|
| 22 |
- |
|
| 23 |
-NETINSTALL_LOCALE=${NETINSTALL_LOCALE:-en_US}
|
|
| 24 |
-NETINSTALL_KEYBOARD=${NETINSTALL_KEYBOARD:-us}
|
|
| 25 |
-NETINSTALL_IFACE=${NETINSTALL_IFACE:-eth3}
|
|
| 26 |
- |
|
| 27 |
-for arch in ${arches[@]} ; do
|
|
| 28 |
- echo "Attempting $distro ($arch)" |
|
| 29 |
- if [[ -n $(xe template-list name-label="$distro ($arch)" params=uuid --minimal) ]] ; then |
|
| 30 |
- echo "$distro ($arch)" already exists, Skipping |
|
| 31 |
- else |
|
| 32 |
- if [ -z $NETINSTALLIP ] |
|
| 33 |
- then |
|
| 34 |
- echo "NETINSTALLIP not set in localrc" |
|
| 35 |
- exit 1 |
|
| 36 |
- fi |
|
| 37 |
- # Some of these settings can be found in example preseed files |
|
| 38 |
- # however these need to be answered before the netinstall |
|
| 39 |
- # is ready to fetch the preseed file, and as such must be here |
|
| 40 |
- # to get a fully automated install |
|
| 41 |
- pvargs="-- quiet console=hvc0 partman/default_filesystem=ext3 locale=${NETINSTALL_LOCALE} console-setup/ask_detect=false keyboard-configuration/layoutcode=${NETINSTALL_KEYBOARD} netcfg/choose_interface=${NETINSTALL_IFACE} netcfg/get_hostname=os netcfg/get_domain=os auto url=${preseedurl}"
|
|
| 42 |
- if [ "$NETINSTALLIP" != "dhcp" ] |
|
| 43 |
- then |
|
| 44 |
- netcfgargs="netcfg/disable_autoconfig=true netcfg/get_nameservers=${NAMESERVERS} netcfg/get_ipaddress=${NETINSTALLIP} netcfg/get_netmask=${NETMASK} netcfg/get_gateway=${GATEWAY} netcfg/confirm_static=true"
|
|
| 45 |
- pvargs="${pvargs} ${netcfgargs}"
|
|
| 46 |
- fi |
|
| 47 |
- NEWUUID=$(xe vm-clone uuid=$LENNY new-name-label="$distro ($arch)") |
|
| 48 |
- xe template-param-set uuid=$NEWUUID other-config:install-methods=http,ftp \ |
|
| 49 |
- other-config:install-repository=http://archive.ubuntu.net/ubuntu \ |
|
| 50 |
- PV-args="$pvargs" \ |
|
| 51 |
- other-config:debian-release=oneiric \ |
|
| 52 |
- other-config:default_template=true |
|
| 53 |
- |
|
| 54 |
- if [[ "$arch" == "32-bit" ]] ; then |
|
| 55 |
- xe template-param-set uuid=$NEWUUID other-config:install-arch="i386" |
|
| 56 |
- else |
|
| 57 |
- xe template-param-set uuid=$NEWUUID other-config:install-arch="amd64" |
|
| 58 |
- fi |
|
| 59 |
- echo "Success" |
|
| 60 |
- fi |
|
| 61 |
-done |
|
| 62 |
- |
|
| 63 |
-echo "Done" |
| ... | ... |
@@ -1,5 +1,10 @@ |
| 1 | 1 |
#!/bin/bash |
| 2 | 2 |
|
| 3 |
+# |
|
| 4 |
+# XenServer specific defaults for the /tools/xen/ scripts |
|
| 5 |
+# Similar to stackrc, you can override these in your localrc |
|
| 6 |
+# |
|
| 7 |
+ |
|
| 3 | 8 |
# Name of this guest |
| 4 | 9 |
GUEST_NAME=${GUEST_NAME:-DevStackOSDomU}
|
| 5 | 10 |
|
| ... | ... |
@@ -10,13 +15,18 @@ OSDOMU_MEM_MB=1024 |
| 10 | 10 |
# VM Password |
| 11 | 11 |
GUEST_PASSWORD=${GUEST_PASSWORD:-secrete}
|
| 12 | 12 |
|
| 13 |
-# Host Interface, i.e. the interface on the nova vm you want to expose the services on |
|
| 14 |
-# Usually either eth2 (management network) or eth3 (public network) |
|
| 13 |
+# Host Interface, i.e. the interface on the nova vm you want to expose the |
|
| 14 |
+# services on. Usually eth2 (management network) or eth3 (public network) and |
|
| 15 | 15 |
# not eth0 (private network with XenServer host) or eth1 (VM traffic network) |
| 16 |
+# This is also used as the interface for the Ubuntu install |
|
| 16 | 17 |
HOST_IP_IFACE=${HOST_IP_IFACE:-eth3}
|
| 17 | 18 |
|
| 19 |
+# |
|
| 18 | 20 |
# Our nova host's network info |
| 19 |
-VM_IP=${VM_IP:-10.255.255.255} # A host-only ip that let's the interface come up, otherwise unused
|
|
| 21 |
+# |
|
| 22 |
+ |
|
| 23 |
+# A host-only ip that let's the interface come up, otherwise unused |
|
| 24 |
+VM_IP=${VM_IP:-10.255.255.255}
|
|
| 20 | 25 |
MGT_IP=${MGT_IP:-172.16.100.55}
|
| 21 | 26 |
PUB_IP=${PUB_IP:-192.168.1.55}
|
| 22 | 27 |
|
| ... | ... |
@@ -38,8 +48,28 @@ MGT_BR=${MGT_BR:-""}
|
| 38 | 38 |
MGT_VLAN=${MGT_VLAN:-101}
|
| 39 | 39 |
MGT_DEV=${MGT_DEV:-eth0}
|
| 40 | 40 |
|
| 41 |
-# Guest installer network |
|
| 41 |
+# Decide if you should enable eth0, |
|
| 42 |
+# the guest installer network |
|
| 43 |
+# You need to disable this on xcp-xapi on Ubuntu 12.04 |
|
| 42 | 44 |
ENABLE_GI=true |
| 43 | 45 |
|
| 44 |
-# Source params |
|
| 46 |
+# Ubuntu install settings |
|
| 47 |
+UBUNTU_INST_RELEASE="oneiric" |
|
| 48 |
+UBUNTU_INST_TEMPLATE_NAME="Ubuntu 11.10 (64-bit) for DevStack" |
|
| 49 |
+# For 12.04 use "precise" and update template name |
|
| 50 |
+# However, for 12.04, you should be using |
|
| 51 |
+# XenServer 6.1 and later or XCP 1.6 or later |
|
| 52 |
+# 11.10 is only really supported with XenServer 6.0.2 and later |
|
| 53 |
+UBUNTU_INST_ARCH="amd64" |
|
| 54 |
+UBUNTU_INST_REPOSITORY="http://archive.ubuntu.net/ubuntu" |
|
| 55 |
+UBUNTU_INST_LOCALE="en_US" |
|
| 56 |
+UBUNTU_INST_KEYBOARD="us" |
|
| 57 |
+# network configuration for HOST_IP_IFACE during install |
|
| 58 |
+UBUNTU_INST_IP="dhcp" |
|
| 59 |
+UBUNTU_INST_NAMESERVERS="" |
|
| 60 |
+UBUNTU_INST_NETMASK="" |
|
| 61 |
+UBUNTU_INST_GATEWAY="" |
|
| 62 |
+ |
|
| 63 |
+# Load stackrc defaults |
|
| 64 |
+# then override with settings from localrc |
|
| 45 | 65 |
cd ../.. && source ./stackrc && cd $TOP_DIR |