Merge "Remove unused files from tools/xen."
diff --git a/tools/xen/build_domU_multi.sh b/tools/xen/build_domU_multi.sh
deleted file mode 100755
index 0eb2077..0000000
--- a/tools/xen/build_domU_multi.sh
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/usr/bin/env bash
-
-# Echo commands
-set -o xtrace
-
-# Head node host, which runs glance, api, keystone
-HEAD_PUB_IP=${HEAD_PUB_IP:-192.168.1.57}
-HEAD_MGT_IP=${HEAD_MGT_IP:-172.16.100.57}
-
-COMPUTE_PUB_IP=${COMPUTE_PUB_IP:-192.168.1.58}
-COMPUTE_MGT_IP=${COMPUTE_MGT_IP:-172.16.100.58}
-
-# Networking params
-FLOATING_RANGE=${FLOATING_RANGE:-192.168.1.196/30}
-
-# Variables common amongst all hosts in the cluster
-COMMON_VARS="$STACKSH_PARAMS MYSQL_HOST=$HEAD_MGT_IP RABBIT_HOST=$HEAD_MGT_IP GLANCE_HOSTPORT=$HEAD_MGT_IP:9292 FLOATING_RANGE=$FLOATING_RANGE"
-
-# Helper to launch containers
-function build_xva {
- GUEST_NAME=$1 PUB_IP=$2 MGT_IP=$3 DO_SHUTDOWN=$4 TERMINATE=$TERMINATE STACKSH_PARAMS="$COMMON_VARS $5" ./build_xva.sh
-}
-
-# Launch the head node - headnode uses a non-ip domain name,
-# because rabbit won't launch with an ip addr hostname :(
-build_xva HEADNODE $HEAD_PUB_IP $HEAD_MGT_IP 1 "ENABLED_SERVICES=g-api,g-reg,key,n-api,n-sch,n-vnc,horizon,mysql,rabbit"
-
-# Build the HA compute host
-build_xva COMPUTENODE $COMPUTE_PUB_IP $COMPUTE_MGT_IP 0 "ENABLED_SERVICES=n-cpu,n-net,n-api"
diff --git a/tools/xen/files/fstab b/tools/xen/files/fstab
deleted file mode 100644
index 6c9b981..0000000
--- a/tools/xen/files/fstab
+++ /dev/null
@@ -1,5 +0,0 @@
-LABEL=vpxroot / ext3 defaults 1 1
-tmpfs /dev/shm tmpfs defaults 0 0
-devpts /dev/pts devpts gid=5,mode=620 0 0
-sysfs /sys sysfs defaults 0 0
-proc /proc proc defaults 0 0
diff --git a/tools/xen/files/hvc0.conf b/tools/xen/files/hvc0.conf
deleted file mode 100644
index 4eedaf6..0000000
--- a/tools/xen/files/hvc0.conf
+++ /dev/null
@@ -1,10 +0,0 @@
-# hvc0 - getty
-#
-# This service maintains a getty on hvc0 from the point the system is
-# started until it is shut down again.
-
-start on stopped rc RUNLEVEL=[2345]
-stop on runlevel [!2345]
-
-respawn
-exec /sbin/getty -8 9600 hvc0
diff --git a/tools/xen/scripts/mkxva b/tools/xen/scripts/mkxva
deleted file mode 100755
index 392c05b..0000000
--- a/tools/xen/scripts/mkxva
+++ /dev/null
@@ -1,365 +0,0 @@
-#!/bin/bash
-#
-# Copyright (c) 2011 Citrix Systems, Inc.
-# Copyright 2011 OpenStack Foundation
-# All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-
-set -eu
-
-set -o xtrace
-
-VBOX_IMG=/output/packages/vbox-img
-
-usage() {
- cat >&2 <<EOF
-$0 -o <output filenames> -t <types> -x <xml files> <fs-staging-dir> <fs-size-MiB> <tmpdir>
- -o: Colon-separated list of output filenames (one for each type).
- -p: Create a disk label and partition within the output image
- -t: Colon-separated list of types of output file. xva and ovf supported.
- -x: XML filenames (one for each type)
-
-EOF
- exit 1
-}
-
-# parse cmdline
-
-OPT_USE_PARTITION=
-OPT_TYPES=
-OPT_OUTPUT_FILES=
-OPT_XML_FILES=
-
-while getopts o:pt:x: o
-do case "$o" in
- o) OPT_OUTPUT_FILES=$(echo "$OPTARG" | sed -e 's/\s*:\s*/ /g')
- ;;
- p) OPT_USE_PARTITION=1
- ;;
- t) OPT_TYPES=$(echo "$OPTARG" | sed -e 's/\s*:\s*/ /g')
- ;;
- x) OPT_XML_FILES=$(echo "$OPTARG" | sed -e 's/\s*:\s*/ /g')
- ;;
- [?]) usage
- ;;
- esac
-done
-shift $((OPTIND-1))
-
-[ $# -ne 3 ] && usage
-FS_STAGING="$1"
-FS_SIZE_MIB="$2"
-TMPDIR="$3"
-
-if [ "$UID" = "0" ]
-then
- SUDO=
-else
- SUDO=sudo
-fi
-
-if [ "$FS_SIZE_MIB" = "0" ]
-then
- # Just create a dummy file. This allows developers to bypass bits of
- # the build by setting the size to 0.
- touch $OPT_OUTPUT_FILES
- exit 0
-fi
-
-# create temporary files and dirs
-FS_TMPFILE=$(mktemp "$TMPDIR/mkxva-fsimg-XXXXX")
-XVA_TARBALL_STAGING=$(mktemp -d "$TMPDIR/mkxva-tarball-staging-XXXXX")
-OVF_STAGING=$(mktemp -d "$TMPDIR/mkxva-ovf-staging-XXXXX")
-
-# Find udevsettle and udevtrigger on this installation
-if [ -x "/sbin/udevsettle" ] ; then
- UDEVSETTLE="/sbin/udevsettle --timeout=30"
-elif [ -x "/sbin/udevadm" ] ; then
- UDEVSETTLE='/sbin/udevadm settle'
-else
- UDEVSETTLE='/bin/true'
-fi
-
-if [ -x "/sbin/udevtrigger" ] ; then
- UDEVTRIGGER=/sbin/udevtrigger
-elif [ -x "/sbin/udevadm" ] ; then
- UDEVTRIGGER='/sbin/udevadm trigger'
-else
- UDEVTRIGGER=
-fi
-
-# CLEAN_ variables track devices and mounts that must be taken down
-# no matter how the script exits. Loop devices are vulnerable to
-# exhaustion so we make every effort to remove them
-
-CLEAN_KPARTX=
-CLEAN_LOSETUP=
-CLEAN_MOUNTPOINT=
-
-cleanup_devices () {
- if [ -n "$CLEAN_MOUNTPOINT" ] ; then
- echo "Mountpoint $CLEAN_MOUNTPOINT removed on abnormal exit"
- $SUDO umount "$CLEAN_MOUNTPOINT" || echo "umount failed"
- rmdir "$CLEAN_MOUNTPOINT" || echo "rmdir failed"
- fi
- if [ -n "$CLEAN_KPARTX" ] ; then
- echo "kpartx devices for $CLEAN_KPARTX removed on abnormal exit"
- $SUDO kpartx -d "$CLEAN_KPARTX" || echo "kpartx -d failed"
- fi
- if [ -n "$CLEAN_LOSETUP" ] ; then
- echo "Loop device $CLEAN_LOSETUP removed on abnormal exit"
- $SUDO losetup -d "$CLEAN_LOSETUP" # Allow losetup errors to propagate
- fi
-}
-
-trap "cleanup_devices" EXIT
-
-make_fs_inner () {
- local staging="$1"
- local output="$2"
- local options="$3"
- CLEAN_MOUNTPOINT=$(mktemp -d "$TMPDIR/mkfs-XXXXXX")
-
- # copy staging dir contents to fs image
- $SUDO mount $options "$output" "$CLEAN_MOUNTPOINT"
- $SUDO tar -C "$staging" -c . | tar -C "$CLEAN_MOUNTPOINT" -x
- $SUDO umount "$CLEAN_MOUNTPOINT"
- rmdir "$CLEAN_MOUNTPOINT"
- CLEAN_MOUNTPOINT=
-}
-
-# Turn a staging dir into an ext3 filesystem within a partition
-make_fs_in_partition () {
- local staging="$1"
- local output="$2"
-
- # create new empty disk
- dd if=/dev/zero of="$output" bs=1M count=$FS_SIZE_MIB
- # Set up a loop device on the empty disk image
- local loopdevice=$($SUDO losetup -f)
- $SUDO losetup "$loopdevice" "$output"
- CLEAN_LOSETUP="$loopdevice"
- # Create a partition table and single partition.
- # Start partition at sector 63 to allow space for grub
- cat <<EOF
-Errors from sfdisk below are expected because the new disk is uninitialised
- Expecting: sfdisk: ERROR: sector 0 does not have an msdos signature
- Expecting: /dev/loop0: unrecognized partition table type
-EOF
- $SUDO sfdisk -uS "$CLEAN_LOSETUP" <<EOF
-63 - - *
-EOF
-
- # kpartx creates a device for the new partition
- # in the form /dev/mapper/loop1p1
- $SUDO kpartx -av "$CLEAN_LOSETUP"
- CLEAN_KPARTX="$CLEAN_LOSETUP"
- # Wait for the device to appear
- $UDEVTRIGGER
- $UDEVSETTLE || echo "udev settle command return code non-zero"
- # Infer the name of the partition device
- local partition="${CLEAN_LOSETUP/dev/dev/mapper}p1"
- # Set permissive privileges on the device
- $SUDO chmod 0777 "$partition"
- # Make an ext3 filesystem on the partition
- /sbin/mkfs.ext3 -I 128 -m0 -F "$partition"
- /sbin/e2label "$partition" vpxroot
- make_fs_inner "$staging" "$partition" ""
-
- # Now run grub on the image we've created
- CLEAN_MOUNTPOINT=$(mktemp -d "$TMPDIR/mkfs-XXXXXX")
-
- # copy Set up[ grub files prior to installing grub within the image
- $SUDO mount "$partition" "$CLEAN_MOUNTPOINT"
- $SUDO cp $CLEAN_MOUNTPOINT/usr/share/grub/i386-redhat/* "$CLEAN_MOUNTPOINT/boot/grub"
- kernel_version=$($SUDO chroot "$CLEAN_MOUNTPOINT" rpm -qv kernel | sed -e 's/kernel-//')
- kernel_version_xen=$($SUDO chroot "$CLEAN_MOUNTPOINT" rpm -qv kernel-xen | sed -e 's/kernel-xen-//')
- $SUDO cat > "$CLEAN_MOUNTPOINT/boot/grub/grub.conf" <<EOF
-default 0
-timeout 2
-
-title vmlinuz-$kernel_version (HVM)
- root (hd0,0)
- kernel /boot/vmlinuz-$kernel_version ro root=LABEL=vpxroot
- initrd /boot/initrd-$kernel_version.img
-
-title vmlinuz-${kernel_version_xen}xen (PV)
- root (hd0,0)
- kernel /boot/vmlinuz-${kernel_version_xen}xen ro root=LABEL=vpxroot console=xvc0
- initrd /boot/initrd-${kernel_version_xen}xen.img
-EOF
-
- $SUDO umount "$CLEAN_MOUNTPOINT"
- CLEAN_MOUNTPOINT=
-
- # Grub expects a disk with name /dev/xxxx with a first partition
- # named /dev/xxxx1, so we give it what it wants using symlinks
- # Note: /dev is linked to the real /dev of the build machine, so
- # must be cleaned up
- local disk_name="/dev/osxva$$bld"
- local disk_part1_name="${disk_name}1"
- rm -f "$disk_name"
- rm -f "$disk_part1_name"
- ln -s "$CLEAN_LOSETUP" "$disk_name"
- ln -s "$partition" "$disk_part1_name"
-
- # Feed commands into the grub shell to setup the disk
- grub --no-curses --device-map=/dev/null <<EOF
-device (hd0) $disk_name
-setup (hd0) (hd0,0)
-quit
-EOF
-
- # Cleanup
- rm -f "$disk_name"
- rm -f "$disk_part1_name"
- $SUDO kpartx -dv "$CLEAN_KPARTX"
- CLEAN_KPARTX=
- $SUDO losetup -d "$CLEAN_LOSETUP"
- CLEAN_LOSETUP=
-}
-
-# turn a staging dir into an ext3 filesystem image
-make_fs () {
- local staging="$1"
- local output="$2"
-
- # create new empty fs
- dd if=/dev/zero of="$output" bs=1M count=0 seek=$FS_SIZE_MIB
- /sbin/mkfs.ext3 -m0 -F "$output"
- /sbin/e2label "$output" vpxroot
- make_fs_inner "$staging" "$output" "-oloop"
-}
-
-
-# split a virtual disk image into the format expected inside an xva file
-splitvdi () {
- local diskimg="$1"
- local outputdir="$2"
- local rio="$3"
-
- local n_bytes=$(stat --printf=%s "$diskimg")
- local n_meg=$((($n_bytes+$((1024*1024 -1)))/$((1024*1024))))
- local i=0
- while [ $i -lt $n_meg ] ; do
- if [ $rio -eq 0 ] ; then
- local file="$outputdir"/chunk-$(printf "%08d" $i)
- dd if="$diskimg" of="$file" skip=$i bs=1M count=1 2>/dev/null
- gzip "$file"
- else
- local file="$outputdir"/$(printf "%08d" $i)
- dd if="$diskimg" of="$file" skip=$i bs=1M count=1 2>/dev/null
- local chksum=$(sha1sum -b "$file")
- echo -n "${chksum/ */}" > "$file.checksum"
- fi
- i=$(($i + 1))
- done
-}
-
-if [ -n "$OPT_USE_PARTITION" ] ; then
- make_fs_in_partition "$FS_STAGING" "$FS_TMPFILE"
-else
- make_fs "$FS_STAGING" "$FS_TMPFILE"
-fi
-
-VDI_SIZE=$(stat --format=%s "$FS_TMPFILE")
-
-make_xva () {
- local output_file="$1"
- local xml_file="$2"
- local subdir
- local rio
-
- if [[ `cat $xml_file` =~ "<member>\s*<name>class</name>\s*<value>VDI</value>\s*</member>\s*<member>\s*<name>id</name>\s*<value>(Ref:[0-9]+)</value>" ]]
- then
- # it's a rio style xva
- subdir="${BASH_REMATCH[1]}";
- rio=1
- else
- # it's a geneva style xva
- subdir="xvda"
- rio=0
- fi
-
- cp "$xml_file" "$XVA_TARBALL_STAGING"/ova.xml
- sed -i -e "s/@VDI_SIZE@/$VDI_SIZE/" "$XVA_TARBALL_STAGING"/ova.xml
- mkdir "$XVA_TARBALL_STAGING/$subdir"
- splitvdi "$FS_TMPFILE" "$XVA_TARBALL_STAGING/$subdir" "$rio"
- TARFILE_MEMBERS=$(cd "$XVA_TARBALL_STAGING" && echo ova.xml $subdir/*)
- tar -C "$XVA_TARBALL_STAGING" --format=v7 -c $TARFILE_MEMBERS -f "$output_file.tmp"
- mv "$output_file.tmp" "$output_file"
-}
-
-make_ovf () {
- local output_dir="$1"
- local xml_file="$2"
- local output_base=$(basename "$output_dir")
- local disk="$output_dir/${output_base}.vmdk"
- local manifest="$output_dir/${output_base}.mf"
- local ovf="$output_dir/${output_base}.ovf"
-
- mkdir -p "$output_dir"
- rm -f "$disk"
- $VBOX_IMG convert --srcfilename="$FS_TMPFILE" --dstfilename="$disk" \
- --srcformat RAW --dstformat VMDK --variant Stream
- chmod 0644 "$disk"
-
- local n_bytes=$(stat --printf=%s "$disk")
- cp "$xml_file" "$ovf"
- sed -i -e "s/@MKXVA_DISK_FULLSIZE@/$VDI_SIZE/" "$ovf"
- sed -i -e "s/@MKXVA_DISK_SIZE@/$n_bytes/" "$ovf"
- sed -i -e "s/@MKXVA_DISK_MIB_SIZE@/$FS_SIZE_MIB/" "$ovf"
- sed -i -e "s/@MKXVA_DISK_FILENAME@/${output_base}.vmdk/" "$ovf"
-
- for to_sign in "$ovf" "$disk"
- do
- local sha1_sum=$(sha1sum "$to_sign" | cut -d' ' -f1)
- echo "SHA1($(basename "$to_sign"))= $sha1_sum" >> $manifest
- done
-}
-
-output_files="$OPT_OUTPUT_FILES"
-xml_files="$OPT_XML_FILES"
-# Iterate through the type list creating the relevant VMs
-for create_type in $OPT_TYPES
-do
- # Shift one parameter from the front of the lists
- create_output_file="${output_files%% *}"
- output_files="${output_files#* }"
- create_xml_file="${xml_files%% *}"
- xml_files="${xml_files#* }"
- echo "Creating $create_type appliance $create_output_file using metadata file $create_xml_file"
-
- case "$create_type" in
- xva)
- make_xva "$create_output_file" "$create_xml_file"
- ;;
- ovf)
- make_ovf "$create_output_file" "$create_xml_file"
- ;;
- *)
- echo "Unknown VM type '$create_type'"
- exit 1
- ;;
- esac
-
-done
-
-
-# cleanup
-if [ -z "${DO_NOT_CLEANUP:-}" ] ; then
- rm -rf "$XVA_TARBALL_STAGING"
- rm -f "$FS_TMPFILE"
-fi
diff --git a/tools/xen/scripts/templatedelete.sh b/tools/xen/scripts/templatedelete.sh
deleted file mode 100755
index 66765b2..0000000
--- a/tools/xen/scripts/templatedelete.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash
-
-#Usage: ./templatedelete.sh <template-uuid>
-
-templateuuid="$1"
-
-xe template-param-set other-config:default_template=false uuid="$templateuuid"
-xe template-param-set is-a-template=false uuid="$templateuuid"
-xe vm-destroy uuid="$templateuuid"
diff --git a/tools/xen/templates/hosts.in b/tools/xen/templates/hosts.in
deleted file mode 100644
index 8ab4c3e..0000000
--- a/tools/xen/templates/hosts.in
+++ /dev/null
@@ -1,8 +0,0 @@
-127.0.0.1 localhost
-127.0.0.1 %HOSTNAME%
-::1 localhost ip6-localhost ip6-loopback
-fe00::0 ip6-localnet
-ff00::0 ip6-mcastprefix
-ff02::1 ip6-allnodes
-ff02::2 ip6-allrouters
-
diff --git a/tools/xen/templates/menu.lst.in b/tools/xen/templates/menu.lst.in
deleted file mode 100644
index 8bc6426..0000000
--- a/tools/xen/templates/menu.lst.in
+++ /dev/null
@@ -1,6 +0,0 @@
-default 0
-
-title default
- root (hd0,0)
- kernel /boot/vmlinuz-@KERNEL_VERSION@ ro root=LABEL=vpxroot console=xvc0
- initrd /boot/initrd.img-@KERNEL_VERSION@
diff --git a/tools/xen/templates/ova.xml.in b/tools/xen/templates/ova.xml.in
deleted file mode 100644
index 01041e2..0000000
--- a/tools/xen/templates/ova.xml.in
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0" ?>
-<appliance version="0.1">
- <vm name="vm">
- <label>
- @PRODUCT_BRAND@ @PRODUCT_VERSION@-@BUILD_NUMBER@
- </label>
- <shortdesc></shortdesc>
- <config mem_set="1073741824" vcpus="1"/>
- <hacks is_hvm="false"/>
- <vbd device="xvda" function="root" mode="w" vdi="vdi_xvda"/>
- </vm>
- <vdi name="vdi_xvda" size="@VDI_SIZE@" source="file://xvda" type="dir-gzipped-chunks" variety="system"/>
-</appliance>
-