XenServer: new build and install scripts
Change-Id: Ia13a9c8073e59edf98415ba5b9f3a9cbd1453d32
This commit is contained in:
parent
836955f825
commit
0af143b34e
2
stack.sh
2
stack.sh
@ -313,7 +313,7 @@ function read_password {
|
|||||||
if [ "$VIRT_DRIVER" = 'xenserver' ]; then
|
if [ "$VIRT_DRIVER" = 'xenserver' ]; then
|
||||||
PUBLIC_INTERFACE_DEFAULT=eth3
|
PUBLIC_INTERFACE_DEFAULT=eth3
|
||||||
# allow build_domU.sh to specify the flat network bridge via kernel args
|
# allow build_domU.sh to specify the flat network bridge via kernel args
|
||||||
FLAT_NETWORK_BRIDGE_DEFAULT=$(grep -o 'flat_network_bridge=[^.]*' /proc/cmdline | cut -d= -f 2)
|
FLAT_NETWORK_BRIDGE_DEFAULT=$(grep -o 'flat_network_bridge=[[:alnum:]]*' /proc/cmdline | cut -d= -f 2 | sort -u)
|
||||||
GUEST_INTERFACE_DEFAULT=eth1
|
GUEST_INTERFACE_DEFAULT=eth1
|
||||||
else
|
else
|
||||||
PUBLIC_INTERFACE_DEFAULT=br100
|
PUBLIC_INTERFACE_DEFAULT=br100
|
||||||
|
@ -1,5 +1,27 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
declare -a on_exit_hooks
|
||||||
|
|
||||||
|
on_exit()
|
||||||
|
{
|
||||||
|
for i in $(seq $((${#on_exit_hooks[*]} - 1)) -1 0)
|
||||||
|
do
|
||||||
|
eval "${on_exit_hooks[$i]}"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
add_on_exit()
|
||||||
|
{
|
||||||
|
local n=${#on_exit_hooks[*]}
|
||||||
|
on_exit_hooks[$n]="$*"
|
||||||
|
if [[ $n -eq 0 ]]
|
||||||
|
then
|
||||||
|
trap on_exit EXIT
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Abort if localrc is not set
|
# Abort if localrc is not set
|
||||||
if [ ! -e ../../localrc ]; then
|
if [ ! -e ../../localrc ]; then
|
||||||
echo "You must have a localrc with ALL necessary passwords defined before proceeding."
|
echo "You must have a localrc with ALL necessary passwords defined before proceeding."
|
||||||
@ -16,27 +38,11 @@ source xenrc
|
|||||||
# Echo commands
|
# Echo commands
|
||||||
set -o xtrace
|
set -o xtrace
|
||||||
|
|
||||||
|
GUEST_NAME="$1"
|
||||||
|
|
||||||
# Directory where we stage the build
|
# Directory where we stage the build
|
||||||
STAGING_DIR=$TOP_DIR/stage
|
STAGING_DIR=$($TOP_DIR/scripts/manage-vdi open $GUEST_NAME 0 1 | grep -o "/tmp/tmp.[[:alnum:]]*")
|
||||||
|
add_on_exit "$TOP_DIR/scripts/manage-vdi close $GUEST_NAME 0 1"
|
||||||
# Option to clean out old stuff
|
|
||||||
CLEAN=${CLEAN:-0}
|
|
||||||
if [ "$CLEAN" = "1" ]; then
|
|
||||||
rm -rf $STAGING_DIR
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Download our base image. This image is made using prepare_guest.sh
|
|
||||||
BASE_IMAGE_URL=${BASE_IMAGE_URL:-http://images.ansolabs.com/xen/stage.tgz}
|
|
||||||
if [ ! -e $STAGING_DIR ]; then
|
|
||||||
if [ ! -e /tmp/stage.tgz ]; then
|
|
||||||
wget $BASE_IMAGE_URL -O /tmp/stage.tgz
|
|
||||||
fi
|
|
||||||
tar xfz /tmp/stage.tgz
|
|
||||||
cd $TOP_DIR
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Free up precious disk space
|
|
||||||
rm -f /tmp/stage.tgz
|
|
||||||
|
|
||||||
# Make sure we have a stage
|
# Make sure we have a stage
|
||||||
if [ ! -d $STAGING_DIR/etc ]; then
|
if [ ! -d $STAGING_DIR/etc ]; then
|
||||||
@ -55,63 +61,26 @@ SCRIPT_DIR=$TOP_DIR/scripts
|
|||||||
UBUNTU_VERSION=`cat $STAGING_DIR/etc/lsb-release | grep "DISTRIB_CODENAME=" | sed "s/DISTRIB_CODENAME=//"`
|
UBUNTU_VERSION=`cat $STAGING_DIR/etc/lsb-release | grep "DISTRIB_CODENAME=" | sed "s/DISTRIB_CODENAME=//"`
|
||||||
KERNEL_VERSION=`ls $STAGING_DIR/boot/vmlinuz* | head -1 | sed "s/.*vmlinuz-//"`
|
KERNEL_VERSION=`ls $STAGING_DIR/boot/vmlinuz* | head -1 | sed "s/.*vmlinuz-//"`
|
||||||
|
|
||||||
# Directory for xvas
|
|
||||||
XVA_DIR=$TOP_DIR/xvas
|
|
||||||
|
|
||||||
# Create xva dir
|
|
||||||
mkdir -p $XVA_DIR
|
|
||||||
|
|
||||||
# Path to xva
|
|
||||||
XVA=$XVA_DIR/$GUEST_NAME.xva
|
|
||||||
|
|
||||||
# Setup fake grub
|
|
||||||
rm -rf $STAGING_DIR/boot/grub/
|
|
||||||
mkdir -p $STAGING_DIR/boot/grub/
|
|
||||||
cp $TEMPLATES_DIR/menu.lst.in $STAGING_DIR/boot/grub/menu.lst
|
|
||||||
sed -e "s,@KERNEL_VERSION@,$KERNEL_VERSION,g" -i $STAGING_DIR/boot/grub/menu.lst
|
|
||||||
|
|
||||||
# Setup fstab, tty, and other system stuff
|
|
||||||
cp $FILES_DIR/fstab $STAGING_DIR/etc/fstab
|
|
||||||
cp $FILES_DIR/hvc0.conf $STAGING_DIR/etc/init/
|
|
||||||
|
|
||||||
# Put the VPX into UTC.
|
|
||||||
rm -f $STAGING_DIR/etc/localtime
|
|
||||||
|
|
||||||
# Configure dns (use same dns as dom0)
|
# Configure dns (use same dns as dom0)
|
||||||
cp /etc/resolv.conf $STAGING_DIR/etc/resolv.conf
|
cp /etc/resolv.conf $STAGING_DIR/etc/resolv.conf
|
||||||
|
|
||||||
# Copy over devstack
|
# Copy over devstack
|
||||||
rm -f /tmp/devstack.tar
|
rm -f /tmp/devstack.tar
|
||||||
tar --exclude='stage' --exclude='xen/xvas' --exclude='xen/nova' -cvf /tmp/devstack.tar $TOP_DIR/../../../devstack
|
cd $TOP_DIR/../../
|
||||||
cd $STAGING_DIR/opt/stack/
|
tar --exclude='stage' --exclude='xen/xvas' --exclude='xen/nova' -cvf /tmp/devstack.tar .
|
||||||
tar xf /tmp/devstack.tar
|
mkdir -p $STAGING_DIR/opt/stack/devstack
|
||||||
|
tar xf /tmp/devstack.tar -C $STAGING_DIR/opt/stack/devstack
|
||||||
cd $TOP_DIR
|
cd $TOP_DIR
|
||||||
|
|
||||||
# Configure OVA
|
|
||||||
VDI_SIZE=$(($VDI_MB*1024*1024))
|
|
||||||
PRODUCT_BRAND=${PRODUCT_BRAND:-openstack}
|
|
||||||
PRODUCT_VERSION=${PRODUCT_VERSION:-001}
|
|
||||||
BUILD_NUMBER=${BUILD_NUMBER:-001}
|
|
||||||
LABEL="$PRODUCT_BRAND $PRODUCT_VERSION-$BUILD_NUMBER"
|
|
||||||
OVA=$STAGING_DIR/tmp/ova.xml
|
|
||||||
cp $TEMPLATES_DIR/ova.xml.in $OVA
|
|
||||||
sed -e "s,@VDI_SIZE@,$VDI_SIZE,g" -i $OVA
|
|
||||||
sed -e "s,@PRODUCT_BRAND@,$PRODUCT_BRAND,g" -i $OVA
|
|
||||||
sed -e "s,@PRODUCT_VERSION@,$PRODUCT_VERSION,g" -i $OVA
|
|
||||||
sed -e "s,@BUILD_NUMBER@,$BUILD_NUMBER,g" -i $OVA
|
|
||||||
|
|
||||||
# Run devstack on launch
|
# Run devstack on launch
|
||||||
cat <<EOF >$STAGING_DIR/etc/rc.local
|
cat <<EOF >$STAGING_DIR/etc/rc.local
|
||||||
# network restart required for getting the right gateway
|
# network restart required for getting the right gateway
|
||||||
/etc/init.d/networking restart
|
/etc/init.d/networking restart
|
||||||
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
|
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
|
||||||
su -c "/opt/stack/run.sh > /opt/stack/run.sh.log" stack
|
su -c "/opt/stack/run.sh > /opt/stack/run.sh.log 2>&1" stack
|
||||||
exit 0
|
exit 0
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Clean old xva. In the future may not do this every time.
|
|
||||||
rm -f $XVA
|
|
||||||
|
|
||||||
# Configure the hostname
|
# Configure the hostname
|
||||||
echo $GUEST_NAME > $STAGING_DIR/etc/hostname
|
echo $GUEST_NAME > $STAGING_DIR/etc/hostname
|
||||||
|
|
||||||
@ -151,10 +120,6 @@ else
|
|||||||
sed -e "s,@ETH3_NETMASK@,$PUB_NETMASK,g" -i $INTERFACES
|
sed -e "s,@ETH3_NETMASK@,$PUB_NETMASK,g" -i $INTERFACES
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -h $STAGING_DIR/sbin/dhclient3 ]; then
|
|
||||||
rm -f $STAGING_DIR/sbin/dhclient3
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Gracefully cp only if source file/dir exists
|
# Gracefully cp only if source file/dir exists
|
||||||
function cp_it {
|
function cp_it {
|
||||||
if [ -e $1 ] || [ -d $1 ]; then
|
if [ -e $1 ] || [ -d $1 ]; then
|
||||||
@ -181,11 +146,4 @@ UPLOAD_LEGACY_TTY=yes HOST_IP=$PUB_IP VIRT_DRIVER=xenserver FORCE=yes MULTI_HOST
|
|||||||
EOF
|
EOF
|
||||||
chmod 755 $STAGING_DIR/opt/stack/run.sh
|
chmod 755 $STAGING_DIR/opt/stack/run.sh
|
||||||
|
|
||||||
# Create xva
|
echo "Done"
|
||||||
if [ ! -e $XVA ]; then
|
|
||||||
rm -rf /tmp/mkxva*
|
|
||||||
UID=0 $SCRIPT_DIR/mkxva -o $XVA -t xva -x $OVA $STAGING_DIR $VDI_MB /tmp/
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Built $(basename $XVA). If your dom0 is on a different machine, copy this to [devstackdir]/tools/xen/$(basename $XVA)"
|
|
||||||
echo "Also copy your localrc to [devstackdir]"
|
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Exit on errors
|
||||||
|
set -o errexit
|
||||||
|
|
||||||
# Abort if localrc is not set
|
# Abort if localrc is not set
|
||||||
if [ ! -e ../../localrc ]; then
|
if [ ! -e ../../localrc ]; then
|
||||||
echo "You must have a localrc with ALL necessary passwords defined before proceeding."
|
echo "You must have a localrc with ALL necessary passwords defined before proceeding."
|
||||||
@ -19,25 +22,29 @@ source xenrc
|
|||||||
# Echo commands
|
# Echo commands
|
||||||
set -o xtrace
|
set -o xtrace
|
||||||
|
|
||||||
# Check for xva file
|
xe_min()
|
||||||
if [ ! -e $XVA ]; then
|
{
|
||||||
echo "Missing xva file. Please run build_xva.sh (ideally on a non dom0 host since the build can require lots of space)."
|
local cmd="$1"
|
||||||
echo "Place the resulting xva file in $XVA"
|
shift
|
||||||
exit 1
|
xe "$cmd" --minimal "$@"
|
||||||
fi
|
}
|
||||||
|
|
||||||
# Make sure we have git
|
|
||||||
if ! which git; then
|
|
||||||
GITDIR=/tmp/git-1.7.7
|
|
||||||
cd /tmp
|
|
||||||
rm -rf $GITDIR*
|
|
||||||
wget http://git-core.googlecode.com/files/git-1.7.7.tar.gz
|
|
||||||
tar xfv git-1.7.7.tar.gz
|
|
||||||
cd $GITDIR
|
|
||||||
./configure --with-curl --with-expat
|
|
||||||
make install
|
|
||||||
cd $TOP_DIR
|
cd $TOP_DIR
|
||||||
|
if [ -f ./master ]
|
||||||
|
then
|
||||||
|
rm -rf ./master
|
||||||
|
rm -rf ./nova
|
||||||
fi
|
fi
|
||||||
|
wget https://github.com/openstack/nova/zipball/master --no-check-certificate
|
||||||
|
unzip -o master -d ./nova
|
||||||
|
cp -pr ./nova/*/plugins/xenserver/xenapi/etc/xapi.d /etc/
|
||||||
|
chmod a+x /etc/xapi.d/plugins/*
|
||||||
|
|
||||||
|
mkdir -p /boot/guest
|
||||||
|
|
||||||
|
GUEST_NAME=${GUEST_NAME:-"DevStackOSDomU"}
|
||||||
|
SNAME="ubuntusnapshot"
|
||||||
|
TNAME="ubuntuready"
|
||||||
|
|
||||||
# Helper to create networks
|
# Helper to create networks
|
||||||
# Uses echo trickery to return network uuid
|
# Uses echo trickery to return network uuid
|
||||||
@ -48,23 +55,23 @@ function create_network() {
|
|||||||
netname=$4
|
netname=$4
|
||||||
if [ -z $br ]
|
if [ -z $br ]
|
||||||
then
|
then
|
||||||
pif=$(xe pif-list --minimal device=$dev VLAN=$vlan)
|
pif=$(xe_min pif-list device=$dev VLAN=$vlan)
|
||||||
if [ -z $pif ]
|
if [ -z $pif ]
|
||||||
then
|
then
|
||||||
net=$(xe network-create name-label=$netname)
|
net=$(xe network-create name-label=$netname)
|
||||||
else
|
else
|
||||||
net=$(xe network-list --minimal PIF-uuids=$pif)
|
net=$(xe_min network-list PIF-uuids=$pif)
|
||||||
fi
|
fi
|
||||||
echo $net
|
echo $net
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
if [ ! $(xe network-list --minimal params=bridge | grep -w --only-matching $br) ]
|
if [ ! $(xe_min network-list params=bridge | grep -w --only-matching $br) ]
|
||||||
then
|
then
|
||||||
echo "Specified bridge $br does not exist"
|
echo "Specified bridge $br does not exist"
|
||||||
echo "If you wish to use defaults, please keep the bridge name empty"
|
echo "If you wish to use defaults, please keep the bridge name empty"
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
net=$(xe network-list --minimal bridge=$br)
|
net=$(xe_min network-list bridge=$br)
|
||||||
echo $net
|
echo $net
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -95,13 +102,13 @@ function create_vlan() {
|
|||||||
then
|
then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
if [ -z $(xe vlan-list --minimal tag=$vlan) ]
|
if [ -z $(xe_min vlan-list tag=$vlan) ]
|
||||||
then
|
then
|
||||||
pif=$(xe pif-list --minimal network-uuid=$net)
|
pif=$(xe_min pif-list network-uuid=$net)
|
||||||
# We created a brand new network this time
|
# We created a brand new network this time
|
||||||
if [ -z $pif ]
|
if [ -z $pif ]
|
||||||
then
|
then
|
||||||
pif=$(xe pif-list --minimal device=$dev VLAN=-1)
|
pif=$(xe_min pif-list device=$dev VLAN=-1)
|
||||||
xe vlan-create pif-uuid=$pif vlan=$vlan network-uuid=$net
|
xe vlan-create pif-uuid=$pif vlan=$vlan network-uuid=$net
|
||||||
else
|
else
|
||||||
echo "VLAN does not exist but PIF attached to this network"
|
echo "VLAN does not exist but PIF attached to this network"
|
||||||
@ -133,24 +140,11 @@ fi
|
|||||||
# Enable ip forwarding at runtime as well
|
# Enable ip forwarding at runtime as well
|
||||||
echo 1 > /proc/sys/net/ipv4/ip_forward
|
echo 1 > /proc/sys/net/ipv4/ip_forward
|
||||||
|
|
||||||
# Set local storage il8n
|
|
||||||
SR_UUID=`xe sr-list --minimal name-label="Local storage"`
|
|
||||||
xe sr-param-set uuid=$SR_UUID other-config:i18n-key=local-storage
|
|
||||||
|
|
||||||
# Checkout nova
|
|
||||||
git_clone $NOVA_REPO $TOP_DIR/nova $NOVA_BRANCH
|
|
||||||
|
|
||||||
# Install plugins
|
|
||||||
cp -pr $TOP_DIR/nova/plugins/xenserver/xenapi/etc/xapi.d /etc/
|
|
||||||
chmod a+x /etc/xapi.d/plugins/*
|
|
||||||
yum --enablerepo=base install -y parted
|
|
||||||
mkdir -p /boot/guest
|
|
||||||
|
|
||||||
# Shutdown previous runs
|
# Shutdown previous runs
|
||||||
DO_SHUTDOWN=${DO_SHUTDOWN:-1}
|
DO_SHUTDOWN=${DO_SHUTDOWN:-1}
|
||||||
if [ "$DO_SHUTDOWN" = "1" ]; then
|
if [ "$DO_SHUTDOWN" = "1" ]; then
|
||||||
# Shutdown all domU's that created previously
|
# Shutdown all domU's that created previously
|
||||||
xe vm-list --minimal name-label="$LABEL" | xargs ./scripts/uninstall-os-vpx.sh
|
xe_min vm-list name-label="$GUEST_NAME" | xargs ./scripts/uninstall-os-vpx.sh
|
||||||
|
|
||||||
# Destroy any instances that were launched
|
# Destroy any instances that were launched
|
||||||
for uuid in `xe vm-list | grep -1 instance | grep uuid | sed "s/.*\: //g"`; do
|
for uuid in `xe vm-list | grep -1 instance | grep uuid | sed "s/.*\: //g"`; do
|
||||||
@ -168,18 +162,54 @@ fi
|
|||||||
|
|
||||||
# Start guest
|
# Start guest
|
||||||
if [ -z $VM_BR ]; then
|
if [ -z $VM_BR ]; then
|
||||||
VM_BR=$(xe network-list --minimal uuid=$VM_NET params=bridge)
|
VM_BR=$(xe_min network-list uuid=$VM_NET params=bridge)
|
||||||
fi
|
fi
|
||||||
if [ -z $MGT_BR ]; then
|
if [ -z $MGT_BR ]; then
|
||||||
MGT_BR=$(xe network-list --minimal uuid=$MGT_NET params=bridge)
|
MGT_BR=$(xe_min network-list uuid=$MGT_NET params=bridge)
|
||||||
fi
|
fi
|
||||||
if [ -z $PUB_BR ]; then
|
if [ -z $PUB_BR ]; then
|
||||||
PUB_BR=$(xe network-list --minimal uuid=$PUB_NET params=bridge)
|
PUB_BR=$(xe_min network-list uuid=$PUB_NET params=bridge)
|
||||||
fi
|
fi
|
||||||
$TOP_DIR/scripts/install-os-vpx.sh -f $XVA -v $VM_BR -m $MGT_BR -p $PUB_BR -l $GUEST_NAME -w -k "flat_network_bridge=${VM_BR}"
|
|
||||||
|
templateuuid=$(xe template-list name-label="$TNAME")
|
||||||
|
if [ -n "$templateuuid" ]
|
||||||
|
then
|
||||||
|
vm_uuid=$(xe vm-install template="$TNAME" new-name-label="$GUEST_NAME")
|
||||||
|
else
|
||||||
|
template=$(xe_min template-list name-label="Ubuntu 11.10 (64-bit)")
|
||||||
|
if [ -z "$template" ]
|
||||||
|
then
|
||||||
|
$TOP_DIR/scripts/xenoneirictemplate.sh
|
||||||
|
fi
|
||||||
|
$TOP_DIR/scripts/install-os-vpx.sh -t "Ubuntu 11.10 (64-bit)" -v $VM_BR -m $MGT_BR -p $PUB_BR -l $GUEST_NAME -r $OSDOMU_MEM_MB -k "flat_network_bridge=${VM_BR}"
|
||||||
|
|
||||||
|
# Wait for install to finish
|
||||||
|
while true
|
||||||
|
do
|
||||||
|
state=$(xe_min vm-list name-label="$GUEST_NAME" power-state=halted)
|
||||||
|
if [ -n "$state" ]
|
||||||
|
then
|
||||||
|
break
|
||||||
|
else
|
||||||
|
echo "Waiting for "$GUEST_NAME" to finish installation..."
|
||||||
|
sleep 30
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
vm_uuid=$(xe_min vm-list name-label="$GUEST_NAME")
|
||||||
|
xe vm-param-set actions-after-reboot=Restart uuid="$vm_uuid"
|
||||||
|
|
||||||
|
# Make template from VM
|
||||||
|
snuuid=$(xe vm-snapshot vm="$GUEST_NAME" new-name-label="$SNAME")
|
||||||
|
template_uuid=$(xe snapshot-clone uuid=$snuuid new-name-label="$TNAME")
|
||||||
|
fi
|
||||||
|
|
||||||
|
$TOP_DIR/build_xva.sh "$GUEST_NAME"
|
||||||
|
|
||||||
|
xe vm-start vm="$GUEST_NAME"
|
||||||
|
|
||||||
if [ $PUB_IP == "dhcp" ]; then
|
if [ $PUB_IP == "dhcp" ]; then
|
||||||
PUB_IP=$(xe vm-list --minimal name-label=$GUEST_NAME params=networks | sed -ne 's,^.*3/ip: \([0-9.]*\).*$,\1,p')
|
PUB_IP=$(xe_min vm-list name-label=$GUEST_NAME params=networks | sed -ne 's,^.*3/ip: \([0-9.]*\).*$,\1,p')
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If we have copied our ssh credentials, use ssh to monitor while the installation runs
|
# If we have copied our ssh credentials, use ssh to monitor while the installation runs
|
8
tools/xen/prepare_guest.sh
Normal file → Executable file
8
tools/xen/prepare_guest.sh
Normal file → Executable file
@ -6,13 +6,6 @@ set -x
|
|||||||
GUEST_PASSWORD=${GUEST_PASSWORD:-secrete}
|
GUEST_PASSWORD=${GUEST_PASSWORD:-secrete}
|
||||||
STAGING_DIR=${STAGING_DIR:-stage}
|
STAGING_DIR=${STAGING_DIR:-stage}
|
||||||
DO_TGZ=${DO_TGZ:-1}
|
DO_TGZ=${DO_TGZ:-1}
|
||||||
KERNEL_VERSION=3.0.0-12-virtual
|
|
||||||
|
|
||||||
# Debootstrap base system
|
|
||||||
if [ ! -d $STAGING_DIR ]; then
|
|
||||||
apt-get install debootstrap
|
|
||||||
debootstrap --arch amd64 oneiric $STAGING_DIR http://us.archive.ubuntu.com/ubuntu/
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Sources.list
|
# Sources.list
|
||||||
cat <<EOF >$STAGING_DIR/etc/apt/sources.list
|
cat <<EOF >$STAGING_DIR/etc/apt/sources.list
|
||||||
@ -28,7 +21,6 @@ EOF
|
|||||||
|
|
||||||
# Install basics
|
# Install basics
|
||||||
chroot $STAGING_DIR apt-get update
|
chroot $STAGING_DIR apt-get update
|
||||||
chroot $STAGING_DIR apt-get install -y linux-image-$KERNEL_VERSION
|
|
||||||
chroot $STAGING_DIR apt-get install -y cracklib-runtime curl wget ssh openssh-server tcpdump ethtool
|
chroot $STAGING_DIR apt-get install -y cracklib-runtime curl wget ssh openssh-server tcpdump ethtool
|
||||||
chroot $STAGING_DIR apt-get install -y curl wget ssh openssh-server python-pip git vim-nox sudo
|
chroot $STAGING_DIR apt-get install -y curl wget ssh openssh-server python-pip git vim-nox sudo
|
||||||
chroot $STAGING_DIR pip install xenapi
|
chroot $STAGING_DIR pip install xenapi
|
||||||
|
@ -332,17 +332,11 @@ set_kernel_params()
|
|||||||
{
|
{
|
||||||
local v="$1"
|
local v="$1"
|
||||||
local args=$KERNEL_PARAMS
|
local args=$KERNEL_PARAMS
|
||||||
local cmdline=$(cat /proc/cmdline)
|
|
||||||
for word in $cmdline
|
|
||||||
do
|
|
||||||
if echo "$word" | grep -q "geppetto"
|
|
||||||
then
|
|
||||||
args="$word $args"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
if [ "$args" != "" ]
|
if [ "$args" != "" ]
|
||||||
then
|
then
|
||||||
echo "Passing Geppetto args to VPX: $args."
|
echo "Passing Geppetto args to VPX: $args."
|
||||||
|
pvargs=$(xe vm-param-get param-name=PV-args uuid="$v")
|
||||||
|
args="$pvargs $args"
|
||||||
xe vm-param-set PV-args="$args" uuid="$v"
|
xe vm-param-set PV-args="$args" uuid="$v"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -429,13 +423,17 @@ then
|
|||||||
elif [ "$TEMPLATE_NAME" ]
|
elif [ "$TEMPLATE_NAME" ]
|
||||||
then
|
then
|
||||||
echo $TEMPLATE_NAME
|
echo $TEMPLATE_NAME
|
||||||
vm_uuid=$(xe_min vm-install template="$TEMPLATE_NAME" new-name-label="DevstackOSDomu")
|
vm_uuid=$(xe_min vm-install template="$TEMPLATE_NAME" new-name-label="$NAME_LABEL")
|
||||||
destroy_vifs "$vm_uuid"
|
destroy_vifs "$vm_uuid"
|
||||||
set_auto_start "$vm_uuid"
|
set_auto_start "$vm_uuid"
|
||||||
create_gi_vif "$vm_uuid"
|
create_gi_vif "$vm_uuid"
|
||||||
create_vm_vif "$vm_uuid"
|
create_vm_vif "$vm_uuid"
|
||||||
create_management_vif "$vm_uuid"
|
create_management_vif "$vm_uuid"
|
||||||
create_public_vif "$vm_uuid"
|
create_public_vif "$vm_uuid"
|
||||||
|
set_kernel_params "$vm_uuid"
|
||||||
|
xe vm-param-set other-config:os-vpx=true uuid="$vm_uuid"
|
||||||
|
xe vm-param-set actions-after-reboot=Destroy uuid="$vm_uuid"
|
||||||
|
set_memory "$vm_uuid"
|
||||||
else
|
else
|
||||||
if [ ! -f "$VPX_FILE" ]
|
if [ ! -f "$VPX_FILE" ]
|
||||||
then
|
then
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Name of this guest
|
# Name of this guest
|
||||||
GUEST_NAME=${GUEST_NAME:-ALLINONE}
|
GUEST_NAME=${GUEST_NAME:-DevStackOSDomU}
|
||||||
|
|
||||||
# Size of image
|
# Size of image
|
||||||
VDI_MB=${VDI_MB:-2500}
|
VDI_MB=${VDI_MB:-5000}
|
||||||
|
|
||||||
# VM Password
|
# VM Password
|
||||||
GUEST_PASSWORD=${GUEST_PASSWORD:-secrete}
|
GUEST_PASSWORD=${GUEST_PASSWORD:-secrete}
|
||||||
@ -35,11 +35,7 @@ MGT_BR=${MGT_BR:-""}
|
|||||||
MGT_VLAN=${MGT_VLAN:-101}
|
MGT_VLAN=${MGT_VLAN:-101}
|
||||||
MGT_DEV=${MGT_DEV:-eth0}
|
MGT_DEV=${MGT_DEV:-eth0}
|
||||||
|
|
||||||
# XVA Directory
|
OSDOMU_MEM_MB=1024
|
||||||
XVA_DIR=${XVA_DIR:-`pwd`/xvas}
|
|
||||||
|
|
||||||
# Path to xva file
|
|
||||||
XVA=${XVA:-$XVA_DIR/$GUEST_NAME.xva }
|
|
||||||
|
|
||||||
# Source params
|
# Source params
|
||||||
cd ../.. && source ./stackrc && cd $TOP_DIR
|
cd ../.. && source ./stackrc && cd $TOP_DIR
|
||||||
|
Loading…
Reference in New Issue
Block a user