From 6e121ff53e85fbe8f9eb9437403a4302bd0ee222 Mon Sep 17 00:00:00 2001 From: John Hua Date: Wed, 8 Jul 2015 03:00:07 +0100 Subject: [PATCH] Remove unused files from tools/xen. Most of unused files were used with build_domU_multi.sh which has been replaced by build_xva.sh. Besides tools/xen/scripts/templatedelete.sh was created for convenience purposes and now not in use. Change-Id: I4282c779629e3413ee3cd3ff134c3b7b19eee487 Closes-Bug: #1470535 --- tools/xen/build_domU_multi.sh | 29 --- tools/xen/files/fstab | 5 - tools/xen/files/hvc0.conf | 10 - tools/xen/scripts/mkxva | 365 ---------------------------- tools/xen/scripts/templatedelete.sh | 9 - tools/xen/templates/hosts.in | 8 - tools/xen/templates/menu.lst.in | 6 - tools/xen/templates/ova.xml.in | 14 -- 8 files changed, 446 deletions(-) delete mode 100755 tools/xen/build_domU_multi.sh delete mode 100644 tools/xen/files/fstab delete mode 100644 tools/xen/files/hvc0.conf delete mode 100755 tools/xen/scripts/mkxva delete mode 100755 tools/xen/scripts/templatedelete.sh delete mode 100644 tools/xen/templates/hosts.in delete mode 100644 tools/xen/templates/menu.lst.in delete mode 100644 tools/xen/templates/ova.xml.in diff --git a/tools/xen/build_domU_multi.sh b/tools/xen/build_domU_multi.sh deleted file mode 100755 index 0eb2077414..0000000000 --- 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 6c9b9818c3..0000000000 --- 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 4eedaf6ee1..0000000000 --- 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 392c05b407..0000000000 --- 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 < -t -x - -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 < "$CLEAN_MOUNTPOINT/boot/grub/grub.conf" </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` =~ "\s*class\s*VDI\s*\s*\s*id\s*(Ref:[0-9]+)" ]] - 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 66765b2446..0000000000 --- a/tools/xen/scripts/templatedelete.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -#Usage: ./templatedelete.sh - -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 8ab4c3e919..0000000000 --- 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 8bc6426251..0000000000 --- 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 01041e2030..0000000000 --- a/tools/xen/templates/ova.xml.in +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - -