diff --git a/exercises/swift.sh b/exercises/swift.sh deleted file mode 100755 index f7be099..0000000 --- a/exercises/swift.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env bash - -# Test swift via the command line tools that ship with it. - -# This script exits on an error so that errors don't compound and you see -# only the first error that occured. -set -o errexit - -# Print the commands being run so that we can see the command that triggers -# an error. It is also useful for following allowing as the install occurs. -set -o xtrace - - -# Settings -# ======== - -# Use openrc + stackrc + localrc for settings -pushd $(cd $(dirname "$0")/.. && pwd) -source ./openrc -popd - - -# Testing Swift -# ============= - -# Check if we have to swift via keystone -swift --auth-version 2 -A http://${HOST_IP}:5000/v2.0 -U admin -K $ADMIN_PASSWORD stat - -# We start by creating a test container -swift --auth-version 2 -A http://${HOST_IP}:5000/v2.0 -U admin -K $ADMIN_PASSWORD post testcontainer - -# add some files into it. -swift --auth-version 2 -A http://${HOST_IP}:5000/v2.0 -U admin -K $ADMIN_PASSWORD upload testcontainer /etc/issue - -# list them -swift --auth-version 2 -A http://${HOST_IP}:5000/v2.0 -U admin -K $ADMIN_PASSWORD list testcontainer - -# And we may want to delete them now that we have tested that -# everything works. -swift --auth-version 2 -A http://${HOST_IP}:5000/v2.0 -U admin -K $ADMIN_PASSWORD delete testcontainer diff --git a/files/000-default.template b/files/000-default.template deleted file mode 100644 index 1d7380d..0000000 --- a/files/000-default.template +++ /dev/null @@ -1,28 +0,0 @@ - - WSGIScriptAlias / %HORIZON_DIR%/openstack-dashboard/dashboard/wsgi/django.wsgi - WSGIDaemonProcess horizon user=%USER% group=%USER% processes=3 threads=10 - SetEnv APACHE_RUN_USER %USER% - SetEnv APACHE_RUN_GROUP %USER% - WSGIProcessGroup horizon - - DocumentRoot %HORIZON_DIR%/.blackhole/ - Alias /media %HORIZON_DIR%/openstack-dashboard/dashboard/static - Alias /vpn /opt/stack/vpn - - - Options FollowSymLinks - AllowOverride None - - - - Options Indexes FollowSymLinks MultiViews - AllowOverride None - Order allow,deny - allow from all - - - ErrorLog /var/log/apache2/error.log - LogLevel warn - CustomLog /var/log/apache2/access.log combined - - diff --git a/files/apts/horizon b/files/apts/horizon deleted file mode 100644 index aa08a31..0000000 --- a/files/apts/horizon +++ /dev/null @@ -1,20 +0,0 @@ -apache2 # NOPRIME -libapache2-mod-wsgi # NOPRIME -python-dateutil -python-paste -python-pastedeploy -python-anyjson -python-routes -python-xattr -python-sqlalchemy -python-webob -python-kombu -pylint -pep8 -python-eventlet -python-nose -python-sphinx -python-mox -python-kombu -python-coverage -python-cherrypy3 # why? diff --git a/files/apts/swift b/files/apts/swift deleted file mode 100644 index f298377..0000000 --- a/files/apts/swift +++ /dev/null @@ -1,17 +0,0 @@ -curl -gcc -memcached # NOPRIME -python-configobj -python-coverage -python-dev -python-eventlet -python-greenlet -python-netifaces -python-nose -python-pastedeploy -python-setuptools -python-simplejson -python-webob -python-xattr -sqlite3 -xfsprogs diff --git a/files/horizon_settings.py b/files/horizon_settings.py deleted file mode 100644 index 05ddfe7..0000000 --- a/files/horizon_settings.py +++ /dev/null @@ -1,110 +0,0 @@ -import os - -DEBUG = True -TEMPLATE_DEBUG = DEBUG -PROD = False -USE_SSL = False - -LOCAL_PATH = os.path.dirname(os.path.abspath(__file__)) - -# FIXME: We need to change this to mysql, instead of sqlite. -DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': os.path.join(LOCAL_PATH, 'dashboard_openstack.sqlite3'), - 'TEST_NAME': os.path.join(LOCAL_PATH, 'test.sqlite3'), - }, -} - -# The default values for these two settings seem to cause issues with apache -CACHE_BACKEND = 'dummy://' -SESSION_ENGINE = 'django.contrib.sessions.backends.cached_db' - -# Send email to the console by default -EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' -# Or send them to /dev/null -#EMAIL_BACKEND = 'django.core.mail.backends.dummy.EmailBackend' - -# django-mailer uses a different settings attribute -MAILER_EMAIL_BACKEND = EMAIL_BACKEND - -# Configure these for your outgoing email host -# EMAIL_HOST = 'smtp.my-company.com' -# EMAIL_PORT = 25 -# EMAIL_HOST_USER = 'djangomail' -# EMAIL_HOST_PASSWORD = 'top-secret!' - -HORIZON_CONFIG = { - 'dashboards': ('nova', 'syspanel', 'settings',), - 'default_dashboard': 'nova', - 'user_home': 'dashboard.views.user_home', -} - -OPENSTACK_HOST = "127.0.0.1" -OPENSTACK_KEYSTONE_URL = "http://%s:5000/v2.0" % OPENSTACK_HOST -# FIXME: this is only needed until keystone fixes its GET /tenants call -# so that it doesn't return everything for admins -OPENSTACK_KEYSTONE_ADMIN_URL = "http://%s:35357/v2.0" % OPENSTACK_HOST -OPENSTACK_KEYSTONE_DEFAULT_ROLE = "Member" - -SWIFT_PAGINATE_LIMIT = 100 - -# Configure quantum connection details for networking -QUANTUM_ENABLED = False -QUANTUM_URL = '%s' % OPENSTACK_HOST -QUANTUM_PORT = '9696' -QUANTUM_TENANT = '1234' -QUANTUM_CLIENT_VERSION='0.1' - -# If you have external monitoring links, eg: -# EXTERNAL_MONITORING = [ -# ['Nagios','http://foo.com'], -# ['Ganglia','http://bar.com'], -# ] - -#LOGGING = { -# 'version': 1, -# # When set to True this will disable all logging except -# # for loggers specified in this configuration dictionary. Note that -# # if nothing is specified here and disable_existing_loggers is True, -# # django.db.backends will still log unless it is disabled explicitly. -# 'disable_existing_loggers': False, -# 'handlers': { -# 'null': { -# 'level': 'DEBUG', -# 'class': 'django.utils.log.NullHandler', -# }, -# 'console': { -# # Set the level to "DEBUG" for verbose output logging. -# 'level': 'INFO', -# 'class': 'logging.StreamHandler', -# }, -# }, -# 'loggers': { -# # Logging from django.db.backends is VERY verbose, send to null -# # by default. -# 'django.db.backends': { -# 'handlers': ['null'], -# 'propagate': False, -# }, -# 'horizon': { -# 'handlers': ['console'], -# 'propagate': False, -# }, -# 'novaclient': { -# 'handlers': ['console'], -# 'propagate': False, -# }, -# 'keystoneclient': { -# 'handlers': ['console'], -# 'propagate': False, -# }, -# 'nose.plugins.manager': { -# 'handlers': ['console'], -# 'propagate': False, -# } -# } -#} - -# How much ram on each compute host? -COMPUTE_HOST_RAM_GB = 16 diff --git a/files/swift/account-server.conf b/files/swift/account-server.conf deleted file mode 100644 index db0f097..0000000 --- a/files/swift/account-server.conf +++ /dev/null @@ -1,20 +0,0 @@ -[DEFAULT] -devices = %NODE_PATH%/node -mount_check = false -bind_port = %BIND_PORT% -user = %USER% -log_facility = LOG_LOCAL%LOG_FACILITY% -swift_dir = %SWIFT_CONFIG_LOCATION% - -[pipeline:main] -pipeline = account-server - -[app:account-server] -use = egg:swift#account - -[account-replicator] -vm_test_mode = yes - -[account-auditor] - -[account-reaper] diff --git a/files/swift/container-server.conf b/files/swift/container-server.conf deleted file mode 100644 index bdc3e3a..0000000 --- a/files/swift/container-server.conf +++ /dev/null @@ -1,22 +0,0 @@ -[DEFAULT] -devices = %NODE_PATH%/node -mount_check = false -bind_port = %BIND_PORT% -user = %USER% -log_facility = LOG_LOCAL%LOG_FACILITY% -swift_dir = %SWIFT_CONFIG_LOCATION% - -[pipeline:main] -pipeline = container-server - -[app:container-server] -use = egg:swift#container - -[container-replicator] -vm_test_mode = yes - -[container-updater] - -[container-auditor] - -[container-sync] diff --git a/files/swift/object-server.conf b/files/swift/object-server.conf deleted file mode 100644 index 06fbffe..0000000 --- a/files/swift/object-server.conf +++ /dev/null @@ -1,20 +0,0 @@ -[DEFAULT] -devices = %NODE_PATH%/node -mount_check = false -bind_port = %BIND_PORT% -user = %USER% -log_facility = LOG_LOCAL%LOG_FACILITY% -swift_dir = %SWIFT_CONFIG_LOCATION% - -[pipeline:main] -pipeline = object-server - -[app:object-server] -use = egg:swift#object - -[object-replicator] -vm_test_mode = yes - -[object-updater] - -[object-auditor] diff --git a/files/swift/proxy-server.conf b/files/swift/proxy-server.conf deleted file mode 100644 index 2db6d32..0000000 --- a/files/swift/proxy-server.conf +++ /dev/null @@ -1,33 +0,0 @@ -[DEFAULT] -bind_port = 8080 -user = %USER% -log_facility = LOG_LOCAL1 -swift_dir = %SWIFT_CONFIG_LOCATION% - -[pipeline:main] -pipeline = healthcheck cache %AUTH_SERVER% proxy-server - -[app:proxy-server] -use = egg:swift#proxy -allow_account_management = true -account_autocreate = true - -[filter:keystone] -use = egg:swiftkeystone2#keystone2 -keystone_admin_token = %SERVICE_TOKEN% -keystone_url = http://localhost:35357/v2.0 -keystone_admin_group = Member - -[filter:tempauth] -use = egg:swift#tempauth -user_admin_admin = admin .admin .reseller_admin -user_test_tester = testing .admin -user_test2_tester2 = testing2 .admin -user_test_tester3 = testing3 -bind_ip = 0.0.0.0 - -[filter:healthcheck] -use = egg:swift#healthcheck - -[filter:cache] -use = egg:swift#memcache diff --git a/files/swift/rsyncd.conf b/files/swift/rsyncd.conf deleted file mode 100644 index 66215c7..0000000 --- a/files/swift/rsyncd.conf +++ /dev/null @@ -1,79 +0,0 @@ -uid = %USER% -gid = %GROUP% -log file = /var/log/rsyncd.log -pid file = /var/run/rsyncd.pid -address = 127.0.0.1 - -[account6012] -max connections = 25 -path = %SWIFT_DATA_LOCATION%/1/node/ -read only = false -lock file = /var/lock/account6012.lock - -[account6022] -max connections = 25 -path = %SWIFT_DATA_LOCATION%/2/node/ -read only = false -lock file = /var/lock/account6022.lock - -[account6032] -max connections = 25 -path = %SWIFT_DATA_LOCATION%/3/node/ -read only = false -lock file = /var/lock/account6032.lock - -[account6042] -max connections = 25 -path = %SWIFT_DATA_LOCATION%/4/node/ -read only = false -lock file = /var/lock/account6042.lock - - -[container6011] -max connections = 25 -path = %SWIFT_DATA_LOCATION%/1/node/ -read only = false -lock file = /var/lock/container6011.lock - -[container6021] -max connections = 25 -path = %SWIFT_DATA_LOCATION%/2/node/ -read only = false -lock file = /var/lock/container6021.lock - -[container6031] -max connections = 25 -path = %SWIFT_DATA_LOCATION%/3/node/ -read only = false -lock file = /var/lock/container6031.lock - -[container6041] -max connections = 25 -path = %SWIFT_DATA_LOCATION%/4/node/ -read only = false -lock file = /var/lock/container6041.lock - - -[object6010] -max connections = 25 -path = %SWIFT_DATA_LOCATION%/1/node/ -read only = false -lock file = /var/lock/object6010.lock - -[object6020] -max connections = 25 -path = %SWIFT_DATA_LOCATION%/2/node/ -read only = false -lock file = /var/lock/object6020.lock - -[object6030] -max connections = 25 -path = %SWIFT_DATA_LOCATION%/3/node/ -read only = false -lock file = /var/lock/object6030.lock - -[object6040] -max connections = 25 -path = %SWIFT_DATA_LOCATION%/4/node/ -read only = false -lock file = /var/lock/object6040.lock diff --git a/files/swift/swift-remakerings b/files/swift/swift-remakerings deleted file mode 100755 index c65353c..0000000 --- a/files/swift/swift-remakerings +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -cd %SWIFT_CONFIG_LOCATION% - -rm -f *.builder *.ring.gz backups/*.builder backups/*.ring.gz - -swift-ring-builder object.builder create %SWIFT_PARTITION_POWER_SIZE% 3 1 -swift-ring-builder object.builder add z1-127.0.0.1:6010/sdb1 1 -swift-ring-builder object.builder add z2-127.0.0.1:6020/sdb2 1 -swift-ring-builder object.builder add z3-127.0.0.1:6030/sdb3 1 -swift-ring-builder object.builder add z4-127.0.0.1:6040/sdb4 1 -swift-ring-builder object.builder rebalance - -swift-ring-builder container.builder create %SWIFT_PARTITION_POWER_SIZE% 3 1 -swift-ring-builder container.builder add z1-127.0.0.1:6011/sdb1 1 -swift-ring-builder container.builder add z2-127.0.0.1:6021/sdb2 1 -swift-ring-builder container.builder add z3-127.0.0.1:6031/sdb3 1 -swift-ring-builder container.builder add z4-127.0.0.1:6041/sdb4 1 -swift-ring-builder container.builder rebalance - -swift-ring-builder account.builder create %SWIFT_PARTITION_POWER_SIZE% 3 1 -swift-ring-builder account.builder add z1-127.0.0.1:6012/sdb1 1 -swift-ring-builder account.builder add z2-127.0.0.1:6022/sdb2 1 -swift-ring-builder account.builder add z3-127.0.0.1:6032/sdb3 1 -swift-ring-builder account.builder add z4-127.0.0.1:6042/sdb4 1 -swift-ring-builder account.builder rebalance diff --git a/files/swift/swift-startmain b/files/swift/swift-startmain deleted file mode 100755 index 69efebd..0000000 --- a/files/swift/swift-startmain +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -swift-init all restart diff --git a/files/swift/swift.conf b/files/swift/swift.conf deleted file mode 100644 index 98df466..0000000 --- a/files/swift/swift.conf +++ /dev/null @@ -1,3 +0,0 @@ -[swift-hash] -# random unique string that can never change (DO NOT LOSE) -swift_hash_path_suffix = %SWIFT_HASH% diff --git a/tools/build_bm.sh b/tools/build_bm.sh deleted file mode 100755 index 44cf303..0000000 --- a/tools/build_bm.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env bash -# Build an OpenStack install on a bare metal machine. -set +x - -# Source params -source ./stackrc - -# Param string to pass to stack.sh. Like "EC2_DMZ_HOST=192.168.1.1 MYSQL_USER=nova" -STACKSH_PARAMS=${STACKSH_PARAMS:-} - -# Option to use the version of devstack on which we are currently working -USE_CURRENT_DEVSTACK=${USE_CURRENT_DEVSTACK:-1} - -# Configure the runner -RUN_SH=`mktemp` -cat > $RUN_SH <$CONFIG_CONF_TMP <$CONFIG_INI_TMP <$CONFIG_INI_TMP <>$CONFIG_INI_TMP <$CFG <$PXEDIR/stack-initrd.gz -fi -cp -pu $PXEDIR/stack-initrd.gz $DEST_DIR/ubuntu - -if [ ! -r $PXEDIR/vmlinuz-*-generic ]; then - MNTDIR=`mktemp -d --tmpdir mntXXXXXXXX` - mount -t ext4 -o loop $PXEDIR/stack-initrd.img $MNTDIR - - if [ ! -r $MNTDIR/boot/vmlinuz-*-generic ]; then - echo "No kernel found" - umount $MNTDIR - rmdir $MNTDIR - exit 1 - else - cp -pu $MNTDIR/boot/vmlinuz-*-generic $PXEDIR - fi - umount $MNTDIR - rmdir $MNTDIR -fi - -# Get generic kernel version -KNAME=`basename $PXEDIR/vmlinuz-*-generic` -KVER=${KNAME#vmlinuz-} -cp -pu $PXEDIR/vmlinuz-$KVER $DEST_DIR/ubuntu -cat >>$CFG <>$CFG <>$CFG <> $MNTDIR/etc/sudoers - - umount $MNTDIR - rmdir $MNTDIR - qemu-nbd -d $NBD - NBD="" - mv $DEV_FILE_TMP $DEV_FILE -fi -rm -f $DEV_FILE_TMP - -# clone git repositories onto the system -# ====================================== - -IMG_FILE_TMP=`mktemp $IMG_FILE.XXXXXX` - -if [ ! -r $IMG_FILE ]; then - NBD=`map_nbd $DEV_FILE` - - # Pre-create the image file - # FIXME(dt): This should really get the partition size to - # pre-create the image file - dd if=/dev/zero of=$IMG_FILE_TMP bs=1 count=1 seek=$((2*1024*1024*1024)) - # Create filesystem image for RAM disk - dd if=${NBD}p1 of=$IMG_FILE_TMP bs=1M - - qemu-nbd -d $NBD - NBD="" - mv $IMG_FILE_TMP $IMG_FILE -fi -rm -f $IMG_FILE_TMP - -MNTDIR=`mktemp -d --tmpdir mntXXXXXXXX` -mount -t ext4 -o loop $IMG_FILE $MNTDIR -cp -p /etc/resolv.conf $MNTDIR/etc/resolv.conf - -# We need to install a non-virtual kernel and modules to boot from -if [ ! -r "`ls $MNTDIR/boot/vmlinuz-*-generic | head -1`" ]; then - chroot $MNTDIR apt-get install -y linux-generic -fi - -# git clone only if directory doesn't exist already. Since ``DEST`` might not -# be owned by the installation user, we create the directory and change the -# ownership to the proper user. -function git_clone { - - # clone new copy or fetch latest changes - CHECKOUT=${MNTDIR}$2 - if [ ! -d $CHECKOUT ]; then - mkdir -p $CHECKOUT - git clone $1 $CHECKOUT - else - pushd $CHECKOUT - git fetch - popd - fi - - # FIXME(ja): checkout specified version (should works for branches and tags) - - pushd $CHECKOUT - # checkout the proper branch/tag - git checkout $3 - # force our local version to be the same as the remote version - git reset --hard origin/$3 - popd - - # give ownership to the stack user - chroot $MNTDIR chown -R stack $2 -} - -git_clone $NOVA_REPO $DEST/nova $NOVA_BRANCH -git_clone $GLANCE_REPO $DEST/glance $GLANCE_BRANCH -git_clone $KEYSTONE_REPO $DEST/keystone $KEYSTONE_BRANCH -git_clone $NOVNC_REPO $DEST/novnc $NOVNC_BRANCH -git_clone $HORIZON_REPO $DEST/horizon $HORIZON_BRANCH -git_clone $NOVACLIENT_REPO $DEST/python-novaclient $NOVACLIENT_BRANCH -git_clone $OPENSTACKX_REPO $DEST/openstackx $OPENSTACKX_BRANCH - -# Use this version of devstack -rm -rf $MNTDIR/$DEST/devstack -cp -pr $CWD $MNTDIR/$DEST/devstack -chroot $MNTDIR chown -R stack $DEST/devstack - -# Configure host network for DHCP -mkdir -p $MNTDIR/etc/network -cat > $MNTDIR/etc/network/interfaces <$MNTDIR/etc/hostname -echo "127.0.0.1 localhost ramstack" >$MNTDIR/etc/hosts - -# Configure the runner -RUN_SH=$MNTDIR/$DEST/run.sh -cat > $RUN_SH < $DEST/run.sh.log -echo >> $DEST/run.sh.log -echo >> $DEST/run.sh.log -echo "All done! Time to start clicking." >> $DEST/run.sh.log -EOF - -# Make the run.sh executable -chmod 755 $RUN_SH -chroot $MNTDIR chown stack $DEST/run.sh - -umount $MNTDIR -rmdir $MNTDIR diff --git a/tools/build_uec.sh b/tools/build_uec.sh deleted file mode 100755 index 8167105..0000000 --- a/tools/build_uec.sh +++ /dev/null @@ -1,300 +0,0 @@ -#!/usr/bin/env bash - -# Make sure that we have the proper version of ubuntu (only works on oneiric) -if ! egrep -q "oneiric" /etc/lsb-release; then - echo "This script only works with ubuntu oneiric." - exit 1 -fi - -# Keep track of the current directory -TOOLS_DIR=$(cd $(dirname "$0") && pwd) -TOP_DIR=`cd $TOOLS_DIR/..; pwd` - -cd $TOP_DIR - -# Source params -source ./stackrc - -# Ubuntu distro to install -DIST_NAME=${DIST_NAME:-oneiric} - -# Configure how large the VM should be -GUEST_SIZE=${GUEST_SIZE:-10G} - -# exit on error to stop unexpected errors -set -o errexit -set -o xtrace - -# Abort if localrc is not set -if [ ! -e $TOP_DIR/localrc ]; then - echo "You must have a localrc with ALL necessary passwords defined before proceeding." - echo "See stack.sh for required passwords." - exit 1 -fi - -# Install deps if needed -DEPS="kvm libvirt-bin kpartx cloud-utils curl" -apt-get install -y --force-yes $DEPS || true # allow this to fail gracefully for concurrent builds - -# Where to store files and instances -WORK_DIR=${WORK_DIR:-/opt/uecstack} - -# Where to store images -image_dir=$WORK_DIR/images/$DIST_NAME -mkdir -p $image_dir - -# Start over with a clean base image, if desired -if [ $CLEAN_BASE ]; then - rm -f $image_dir/disk -fi - -# Get the base image if it does not yet exist -if [ ! -e $image_dir/disk ]; then - $TOOLS_DIR/get_uec_image.sh -r $GUEST_SIZE $DIST_NAME $image_dir/disk $image_dir/kernel -fi - -# Copy over dev environment if COPY_ENV is set. -# This will also copy over your current devstack. -if [ $COPY_ENV ]; then - cd $TOOLS_DIR - ./copy_dev_environment_to_uec.sh $image_dir/disk -fi - -# Option to warm the base image with software requirements. -if [ $WARM_CACHE ]; then - cd $TOOLS_DIR - ./warm_apts_and_pips_for_uec.sh $image_dir/disk -fi - -# Name of our instance, used by libvirt -GUEST_NAME=${GUEST_NAME:-devstack} - -# Mop up after previous runs -virsh destroy $GUEST_NAME || true - -# Where this vm is stored -vm_dir=$WORK_DIR/instances/$GUEST_NAME - -# Create vm dir and remove old disk -mkdir -p $vm_dir -rm -f $vm_dir/disk - -# Create a copy of the base image -qemu-img create -f qcow2 -b $image_dir/disk $vm_dir/disk - -# Back to devstack -cd $TOP_DIR - -GUEST_NETWORK=${GUEST_NETWORK:-1} -GUEST_RECREATE_NET=${GUEST_RECREATE_NET:-yes} -GUEST_IP=${GUEST_IP:-192.168.$GUEST_NETWORK.50} -GUEST_CIDR=${GUEST_CIDR:-$GUEST_IP/24} -GUEST_NETMASK=${GUEST_NETMASK:-255.255.255.0} -GUEST_GATEWAY=${GUEST_GATEWAY:-192.168.$GUEST_NETWORK.1} -GUEST_MAC=${GUEST_MAC:-"02:16:3e:07:69:`printf '%02X' $GUEST_NETWORK`"} -GUEST_RAM=${GUEST_RAM:-1524288} -GUEST_CORES=${GUEST_CORES:-1} - -# libvirt.xml configuration -NET_XML=$vm_dir/net.xml -NET_NAME=${NET_NAME:-devstack-$GUEST_NETWORK} -cat > $NET_XML < - $NET_NAME - - - - - - - - -EOF - -if [[ "$GUEST_RECREATE_NET" == "yes" ]]; then - virsh net-destroy $NET_NAME || true - # destroying the network isn't enough to delete the leases - rm -f /var/lib/libvirt/dnsmasq/$NET_NAME.leases - virsh net-create $vm_dir/net.xml -fi - -# libvirt.xml configuration -LIBVIRT_XML=$vm_dir/libvirt.xml -cat > $LIBVIRT_XML < - $GUEST_NAME - $GUEST_RAM - - hvm - $image_dir/kernel - root=/dev/vda ro console=ttyS0 init=/usr/lib/cloud-init/uncloud-init ds=nocloud-net;s=http://192.168.$GUEST_NETWORK.1:4567/ ubuntu-pass=ubuntu - - - - - - $GUEST_CORES - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -EOF - - -rm -rf $vm_dir/uec -cp -r $TOOLS_DIR/uec $vm_dir/uec - -# set metadata -cat > $vm_dir/uec/meta-data< $vm_dir/uec/user-data< localrc <> $vm_dir/uec/user-data< /opt/stack/.ssh/authorized_keys -chown -R stack /opt/stack -chmod 700 /opt/stack/.ssh -chmod 600 /opt/stack/.ssh/authorized_keys - -grep -q "^#includedir.*/etc/sudoers.d" /etc/sudoers || - echo "#includedir /etc/sudoers.d" >> /etc/sudoers -( umask 226 && echo "stack ALL=(ALL) NOPASSWD:ALL" \ - > /etc/sudoers.d/50_stack_sh ) -EOF -fi - -# Run stack.sh -cat >> $vm_dir/uec/user-data< $MNT_DIR/etc/network/interfaces <$MNT_DIR/etc/hostname -echo "127.0.0.1 localhost ramstack" >$MNT_DIR/etc/hosts - -# Configure the runner -RUN_SH=$MNT_DIR/$DEST/run.sh -cat > $RUN_SH < $DEST/run.sh.log -echo >> $DEST/run.sh.log -echo >> $DEST/run.sh.log -echo "All done! Time to start clicking." >> $DEST/run.sh.log -EOF - -# Make the run.sh executable -chmod 755 $RUN_SH -chroot $MNT_DIR chown stack $DEST/run.sh - -umount $MNT_DIR/dev -umount $MNT_DIR -rmdir $MNT_DIR -mv $DEST_FILE_TMP $DEST_FILE -rm -f $DEST_FILE_TMP - -trap - SIGHUP SIGINT SIGTERM SIGQUIT EXIT diff --git a/tools/build_usb_boot.sh b/tools/build_usb_boot.sh deleted file mode 100755 index cca2a68..0000000 --- a/tools/build_usb_boot.sh +++ /dev/null @@ -1,146 +0,0 @@ -#!/bin/bash -e -# build_usb_boot.sh - Create a syslinux boot environment -# -# build_usb_boot.sh destdev -# -# Assumes syslinux is installed -# Needs to run as root - -DEST_DIR=${1:-/tmp/syslinux-boot} -PXEDIR=${PXEDIR:-/opt/ramstack/pxe} -PROGDIR=`dirname $0` - -# Clean up any resources that may be in use -cleanup() { - set +o errexit - - # Mop up temporary files - if [ -n "$DEST_DEV" ]; then - umount $DEST_DIR - rmdir $DEST_DIR - fi - if [ -n "$MNTDIR" -a -d "$MNTDIR" ]; then - umount $MNTDIR - rmdir $MNTDIR - fi - - # Kill ourselves to signal any calling process - trap 2; kill -2 $$ -} - -trap cleanup SIGHUP SIGINT SIGTERM SIGQUIT EXIT - -# Keep track of the current directory -TOOLS_DIR=$(cd $(dirname "$0") && pwd) -TOP_DIR=`cd $TOOLS_DIR/..; pwd` - -if [ -b $DEST_DIR ]; then - # We have a block device, install syslinux and mount it - DEST_DEV=$DEST_DIR - DEST_DIR=`mktemp -d --tmpdir mntXXXXXX` - mount $DEST_DEV $DEST_DIR - - if [ ! -d $DEST_DIR/syslinux ]; then - mkdir -p $DEST_DIR/syslinux - fi - - # Install syslinux on the device - syslinux --install --directory syslinux $DEST_DEV -else - # We have a directory (for sanity checking output) - DEST_DEV="" - if [ ! -d $DEST_DIR/syslinux ]; then - mkdir -p $DEST_DIR/syslinux - fi -fi - -# Get some more stuff from syslinux -for i in memdisk menu.c32; do - cp -pu /usr/lib/syslinux/$i $DEST_DIR/syslinux -done - -CFG=$DEST_DIR/syslinux/syslinux.cfg -cat >$CFG <$PXEDIR/stack-initrd.gz -fi -cp -pu $PXEDIR/stack-initrd.gz $DEST_DIR/ubuntu - -if [ ! -r $PXEDIR/vmlinuz-*-generic ]; then - MNTDIR=`mktemp -d --tmpdir mntXXXXXXXX` - mount -t ext4 -o loop $PXEDIR/stack-initrd.img $MNTDIR - - if [ ! -r $MNTDIR/boot/vmlinuz-*-generic ]; then - echo "No kernel found" - umount $MNTDIR - rmdir $MNTDIR - if [ -n "$DEST_DEV" ]; then - umount $DEST_DIR - rmdir $DEST_DIR - fi - exit 1 - else - cp -pu $MNTDIR/boot/vmlinuz-*-generic $PXEDIR - fi - umount $MNTDIR - rmdir $MNTDIR -fi - -# Get generic kernel version -KNAME=`basename $PXEDIR/vmlinuz-*-generic` -KVER=${KNAME#vmlinuz-} -cp -pu $PXEDIR/vmlinuz-$KVER $DEST_DIR/ubuntu -cat >>$CFG <>$CFG <>$CFG < $STAGING_DIR/etc/sudoers.d/50_stack_sh ) - -# Gracefully cp only if source file/dir exists -function cp_it { - if [ -e $1 ] || [ -d $1 ]; then - cp -pRL $1 $2 - fi -} - -# Copy over your ssh keys and env if desired -cp_it ~/.ssh $STAGING_DIR/$DEST/.ssh -cp_it ~/.ssh/id_rsa.pub $STAGING_DIR/$DEST/.ssh/authorized_keys -cp_it ~/.gitconfig $STAGING_DIR/$DEST/.gitconfig -cp_it ~/.vimrc $STAGING_DIR/$DEST/.vimrc -cp_it ~/.bashrc $STAGING_DIR/$DEST/.bashrc - -# Copy devstack -rm -rf $STAGING_DIR/$DEST/devstack -cp_it . $STAGING_DIR/$DEST/devstack - -# Give stack ownership over $DEST so it may do the work needed -chroot $STAGING_DIR chown -R stack $DEST - -# Unmount -umount $STAGING_DIR diff --git a/tools/get_uec_image.sh b/tools/get_uec_image.sh deleted file mode 100755 index f66f2bc..0000000 --- a/tools/get_uec_image.sh +++ /dev/null @@ -1,103 +0,0 @@ -#!/bin/bash -# get_uec_image.sh - Prepare Ubuntu UEC images - -CACHEDIR=${CACHEDIR:-/opt/stack/cache} -ROOTSIZE=${ROOTSIZE:-2000} - -# Keep track of the current directory -TOOLS_DIR=$(cd $(dirname "$0") && pwd) -TOP_DIR=`cd $TOOLS_DIR/..; pwd` - -# exit on error to stop unexpected errors -set -o errexit -set -o xtrace - -usage() { - echo "Usage: $0 - Fetch and prepare Ubuntu images" - echo "" - echo "$0 [-r rootsize] release imagefile [kernel]" - echo "" - echo "-r size - root fs size (min 2000MB)" - echo "release - Ubuntu release: jaunty - oneric" - echo "imagefile - output image file" - echo "kernel - output kernel" - exit 1 -} - -# Clean up any resources that may be in use -cleanup() { - set +o errexit - - # Mop up temporary files - if [ -n "$IMG_FILE_TMP" -a -e "$IMG_FILE_TMP" ]; then - rm -f $IMG_FILE_TMP - fi - - # Kill ourselves to signal any calling process - trap 2; kill -2 $$ -} - -while getopts hr: c; do - case $c in - h) usage - ;; - r) ROOTSIZE=$OPTARG - ;; - esac -done -shift `expr $OPTIND - 1` - -if [[ ! "$#" -eq "2" && ! "$#" -eq "3" ]]; then - usage -fi - -# Default args -DIST_NAME=$1 -IMG_FILE=$2 -IMG_FILE_TMP=`mktemp $IMG_FILE.XXXXXX` -KERNEL=$3 - -case $DIST_NAME in - oneiric) ;; - natty) ;; - maverick) ;; - lucid) ;; - *) echo "Unknown release: $DIST_NAME" - usage - ;; -esac - -trap cleanup SIGHUP SIGINT SIGTERM SIGQUIT EXIT - -# Check dependencies -if [ ! -x "`which qemu-img`" -o -z "`dpkg -l | grep cloud-utils`" ]; then - # Missing KVM? - apt_get install qemu-kvm cloud-utils -fi - -# Find resize script -RESIZE=`which resize-part-image || which uec-resize-image` -if [ -z "$RESIZE" ]; then - echo "resize tool from cloud-utils not found" - exit 1 -fi - -# Get the UEC image -UEC_NAME=$DIST_NAME-server-cloudimg-amd64 -if [ ! -d $CACHEDIR ]; then - mkdir -p $CACHEDIR/$DIST_NAME -fi -if [ ! -e $CACHEDIR/$DIST_NAME/$UEC_NAME.tar.gz ]; then - (cd $CACHEDIR/$DIST_NAME && wget -N http://uec-images.ubuntu.com/$DIST_NAME/current/$UEC_NAME.tar.gz) - (cd $CACHEDIR/$DIST_NAME && tar Sxvzf $UEC_NAME.tar.gz) -fi - -$RESIZE $CACHEDIR/$DIST_NAME/$UEC_NAME.img ${ROOTSIZE} $IMG_FILE_TMP -mv $IMG_FILE_TMP $IMG_FILE - -# Copy kernel to destination -if [ -n "$KERNEL" ]; then - cp -p $CACHEDIR/$DIST_NAME/*-vmlinuz-virtual $KERNEL -fi - -trap - SIGHUP SIGINT SIGTERM SIGQUIT EXIT diff --git a/tools/install_openvpn.sh b/tools/install_openvpn.sh deleted file mode 100755 index 44eee72..0000000 --- a/tools/install_openvpn.sh +++ /dev/null @@ -1,218 +0,0 @@ -#!/bin/bash -# install_openvpn.sh - Install OpenVPN and generate required certificates -# -# install_openvpn.sh --client name -# install_openvpn.sh --server [name] -# -# name is used on the CN of the generated cert, and the filename of -# the configuration, certificate and key files. -# -# --server mode configures the host with a running OpenVPN server instance -# --client mode creates a tarball of a client configuration for this server - -# Get config file -if [ -e localrc ]; then - . localrc -fi -if [ -e vpnrc ]; then - . vpnrc -fi - -# Do some IP manipulation -function cidr2netmask() { - set -- $(( 5 - ($1 / 8) )) 255 255 255 255 $(( (255 << (8 - ($1 % 8))) & 255 )) 0 0 0 - if [[ $1 -gt 1 ]]; then - shift $1 - else - shift - fi - echo ${1-0}.${2-0}.${3-0}.${4-0} -} - -FIXED_NET=`echo $FIXED_RANGE | cut -d'/' -f1` -FIXED_CIDR=`echo $FIXED_RANGE | cut -d'/' -f2` -FIXED_MASK=`cidr2netmask $FIXED_CIDR` - -# VPN Config -VPN_SERVER=${VPN_SERVER:-`ifconfig eth0 | awk "/inet addr:/ { print \$2 }" | cut -d: -f2`} # 50.56.12.212 -VPN_PROTO=${VPN_PROTO:-tcp} -VPN_PORT=${VPN_PORT:-6081} -VPN_DEV=${VPN_DEV:-tap0} -VPN_BRIDGE=${VPN_BRIDGE:-br100} -VPN_BRIDGE_IF=${VPN_BRIDGE_IF:-$FLAT_INTERFACE} -VPN_CLIENT_NET=${VPN_CLIENT_NET:-$FIXED_NET} -VPN_CLIENT_MASK=${VPN_CLIENT_MASK:-$FIXED_MASK} -VPN_CLIENT_DHCP="${VPN_CLIENT_DHCP:-net.1 net.254}" - -VPN_DIR=/etc/openvpn -CA_DIR=$VPN_DIR/easy-rsa - -usage() { - echo "$0 - OpenVPN install and certificate generation" - echo "" - echo "$0 --client name" - echo "$0 --server [name]" - echo "" - echo " --server mode configures the host with a running OpenVPN server instance" - echo " --client mode creates a tarball of a client configuration for this server" - exit 1 -} - -if [ -z $1 ]; then - usage -fi - -# Install OpenVPN -VPN_EXEC=`which openvpn` -if [ -z "$VPN_EXEC" -o ! -x "$VPN_EXEC" ]; then - apt-get install -y openvpn bridge-utils -fi -if [ ! -d $CA_DIR ]; then - cp -pR /usr/share/doc/openvpn/examples/easy-rsa/2.0/ $CA_DIR -fi - -# Keep track of the current directory -TOOLS_DIR=$(cd $(dirname "$0") && pwd) -TOP_DIR=$(cd $TOOLS_DIR/.. && pwd) - -WEB_DIR=$TOP_DIR/../vpn -if [[ ! -d $WEB_DIR ]]; then - mkdir -p $WEB_DIR -fi -WEB_DIR=$(cd $TOP_DIR/../vpn && pwd) - -cd $CA_DIR -source ./vars - -# Override the defaults -export KEY_COUNTRY="US" -export KEY_PROVINCE="TX" -export KEY_CITY="SanAntonio" -export KEY_ORG="Cloudbuilders" -export KEY_EMAIL="rcb@lists.rackspace.com" - -if [ ! -r $CA_DIR/keys/dh1024.pem ]; then - # Initialize a new CA - $CA_DIR/clean-all - $CA_DIR/build-dh - $CA_DIR/pkitool --initca - openvpn --genkey --secret $CA_DIR/keys/ta.key ## Build a TLS key -fi - -do_server() { - NAME=$1 - # Generate server certificate - $CA_DIR/pkitool --server $NAME - - (cd $CA_DIR/keys; - cp $NAME.crt $NAME.key ca.crt dh1024.pem ta.key $VPN_DIR - ) - cat >$VPN_DIR/br-up <$VPN_DIR/br-down <$VPN_DIR/$NAME.conf <$TMP_DIR/$HOST.conf <$VPN_DIR/hostname - fi - do_server $NAME - ;; - --clean) $CA_DIR/clean-all - ;; - *) usage -esac diff --git a/tools/jenkins/README.md b/tools/jenkins/README.md deleted file mode 100644 index 371017d..0000000 --- a/tools/jenkins/README.md +++ /dev/null @@ -1,38 +0,0 @@ -Getting Started With Jenkins and Devstack -========================================= -This little corner of devstack is to show how to get an Openstack jenkins -environment up and running quickly, using the rcb configuration methodology. - - -To create a jenkins server --------------------------- - - cd tools/jenkins/jenkins_home - ./build_jenkins.sh - -This will create a jenkins environment configured with sample test scripts that run against xen and kvm. - -Configuring XS --------------- -In order to make the tests for XS work, you must install xs 5.6 on a separate machine, -and install the the jenkins public key on that server. You then need to create the -/var/lib/jenkins/xenrc on your jenkins server like so: - - MYSQL_PASSWORD=secrete - SERVICE_TOKEN=secrete - ADMIN_PASSWORD=secrete - RABBIT_PASSWORD=secrete - # This is the password for your guest (for both stack and root users) - GUEST_PASSWORD=secrete - # Do not download the usual images yet! - IMAGE_URLS="" - FLOATING_RANGE=192.168.1.224/28 - VIRT_DRIVER=xenserver - # Explicitly set multi-host - MULTI_HOST=1 - # Give extra time for boot - ACTIVE_TIMEOUT=45 - # IMPORTANT: This is the ip of your xenserver - XEN_IP=10.5.5.1 - # IMPORTANT: The following must be set to your dom0 root password! - XENAPI_PASSWORD='MY_XEN_ROOT_PW' diff --git a/tools/jenkins/adapters/euca.sh b/tools/jenkins/adapters/euca.sh deleted file mode 100755 index b49ce9f..0000000 --- a/tools/jenkins/adapters/euca.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -# Echo commands, exit on error -set -o xtrace -set -o errexit - -TOP_DIR=$(cd ../../.. && pwd) -HEAD_IP=`cat $TOP_DIR/addresses | grep HEAD | cut -d "=" -f2` -ssh stack@$HEAD_IP 'cd devstack && source openrc && cd exercises && ./euca.sh' diff --git a/tools/jenkins/adapters/floating_ips.sh b/tools/jenkins/adapters/floating_ips.sh deleted file mode 100755 index a97f935..0000000 --- a/tools/jenkins/adapters/floating_ips.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -# Echo commands, exit on error -set -o xtrace -set -o errexit - -TOP_DIR=$(cd ../../.. && pwd) -HEAD_IP=`cat $TOP_DIR/addresses | grep HEAD | cut -d "=" -f2` -ssh stack@$HEAD_IP 'cd devstack && source openrc && cd exercises && ./floating_ips.sh' diff --git a/tools/jenkins/build_configuration.sh b/tools/jenkins/build_configuration.sh deleted file mode 100755 index e295ef2..0000000 --- a/tools/jenkins/build_configuration.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -EXECUTOR_NUMBER=$1 -CONFIGURATION=$2 -ADAPTER=$3 -RC=$4 - -function usage() { - echo "Usage: $0 - Build a configuration" - echo "" - echo "$0 [EXECUTOR_NUMBER] [CONFIGURATION] [ADAPTER] [RC (optional)]" - exit 1 -} - -# Validate inputs -if [[ "$EXECUTOR_NUMBER" = "" || "$CONFIGURATION" = "" || "$ADAPTER" = "" ]]; then - usage -fi - -# Execute configuration script -cd configurations && ./$CONFIGURATION.sh $EXECUTOR_NUMBER $CONFIGURATION $ADAPTER "$RC" diff --git a/tools/jenkins/configurations/kvm.sh b/tools/jenkins/configurations/kvm.sh deleted file mode 100755 index 727b42a..0000000 --- a/tools/jenkins/configurations/kvm.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/bash - -# exit on error to stop unexpected errors -set -o errexit -set -o xtrace - -EXECUTOR_NUMBER=$1 -CONFIGURATION=$2 -ADAPTER=$3 -RC=$4 - -function usage() { - echo "Usage: $0 - Build a test configuration" - echo "" - echo "$0 [EXECUTOR_NUMBER] [CONFIGURATION] [ADAPTER] [RC (optional)]" - exit 1 -} - -# Validate inputs -if [[ "$EXECUTOR_NUMBER" = "" || "$CONFIGURATION" = "" || "$ADAPTER" = "" ]]; then - usage -fi - -# This directory -CUR_DIR=$(cd $(dirname "$0") && pwd) - -# devstack directory -cd ../../.. -TOP_DIR=$(pwd) - -# Deps -apt-get install -y --force-yes libvirt-bin || true - -# Name test instance based on executor -BASE_NAME=executor-`printf "%02d" $EXECUTOR_NUMBER` -GUEST_NAME=$BASE_NAME.$ADAPTER -virsh list | grep $BASE_NAME | cut -d " " -f1 | xargs -n 1 virsh destroy || true -virsh net-list | grep $BASE_NAME | cut -d " " -f1 | xargs -n 1 virsh net-destroy || true - -# Configure localrc -cat <localrc -RECLONE=yes -GUEST_NETWORK=$EXECUTOR_NUMBER -GUEST_NAME=$GUEST_NAME -FLOATING_RANGE=192.168.$EXECUTOR_NUMBER.128/27 -GUEST_CORES=1 -GUEST_RAM=12574720 -MYSQL_PASSWORD=chicken -RABBIT_PASSWORD=chicken -SERVICE_TOKEN=chicken -ADMIN_PASSWORD=chicken -USERNAME=admin -TENANT=admin -NET_NAME=$BASE_NAME -ACTIVE_TIMEOUT=45 -BOOT_TIMEOUT=45 -$RC -EOF -cd tools -sudo ./build_uec.sh - -# Make the address of the instances available to test runners -echo HEAD=`cat /var/lib/libvirt/dnsmasq/$BASE_NAME.leases | cut -d " " -f3` > $TOP_DIR/addresses diff --git a/tools/jenkins/configurations/xs.sh b/tools/jenkins/configurations/xs.sh deleted file mode 100755 index 864f949..0000000 --- a/tools/jenkins/configurations/xs.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/bash -set -o errexit -set -o xtrace - - -EXECUTOR_NUMBER=$1 -CONFIGURATION=$2 -ADAPTER=$3 -RC=$4 - -function usage() { - echo "Usage: $0 - Build a test configuration" - echo "" - echo "$0 [EXECUTOR_NUMBER] [CONFIGURATION] [ADAPTER] [RC (optional)]" - exit 1 -} - -# Validate inputs -if [[ "$EXECUTOR_NUMBER" = "" || "$CONFIGURATION" = "" || "$ADAPTER" = "" ]]; then - usage -fi - -# Configuration of xenrc -XENRC=/var/lib/jenkins/xenrc -if [ ! -e $XENRC ]; then - echo "/var/lib/jenkins/xenrc is not present! See README.md" - exit 1 -fi - -# Move to top of devstack -cd ../../.. - -# Use xenrc as the start of our localrc -cp $XENRC localrc - -# Set the PUB_IP -PUB_IP=192.168.1.1$EXECUTOR_NUMBER -echo "PUB_IP=$PUB_IP" >> localrc - -# Overrides -echo "$RC" >> localrc - -# Source localrc -. localrc - -# Make host ip available to tester -echo "HEAD=$PUB_IP" > addresses - -# Build configuration -REMOTE_DEVSTACK=/root/devstack -ssh root@$XEN_IP "rm -rf $REMOTE_DEVSTACK" -scp -pr . root@$XEN_IP:$REMOTE_DEVSTACK -ssh root@$XEN_IP "cd $REMOTE_DEVSTACK/tools/xen && ./build_domU.sh" diff --git a/tools/jenkins/jenkins_home/.gitignore b/tools/jenkins/jenkins_home/.gitignore deleted file mode 100644 index d831d01..0000000 --- a/tools/jenkins/jenkins_home/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -builds -workspace -*.sw* diff --git a/tools/jenkins/jenkins_home/build_jenkins.sh b/tools/jenkins/jenkins_home/build_jenkins.sh deleted file mode 100755 index e0e774e..0000000 --- a/tools/jenkins/jenkins_home/build_jenkins.sh +++ /dev/null @@ -1,108 +0,0 @@ -#!/bin/bash - -# Echo commands, exit on error -set -o xtrace -set -o errexit - -# Make sure only root can run our script -if [[ $EUID -ne 0 ]]; then - echo "This script must be run as root" - exit 1 -fi - -# This directory -CUR_DIR=$(cd $(dirname "$0") && pwd) - -# Configure trunk jenkins! -echo "deb http://pkg.jenkins-ci.org/debian binary/" > /etc/apt/sources.list.d/jenkins.list -wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add - -apt-get update - - -# Clean out old jenkins - useful if you are having issues upgrading -CLEAN_JENKINS=${CLEAN_JENKINS:-no} -if [ "$CLEAN_JENKINS" = "yes" ]; then - apt-get remove jenkins jenkins-common -fi - -# Install software -DEPS="jenkins cloud-utils" -apt-get install -y --force-yes $DEPS - -# Install jenkins -if [ ! -e /var/lib/jenkins ]; then - echo "Jenkins installation failed" - exit 1 -fi - -# Make sure user has configured a jenkins ssh pubkey -if [ ! -e /var/lib/jenkins/.ssh/id_rsa.pub ]; then - echo "Public key for jenkins is missing. This is used to ssh into your instances." - echo "Please run "su -c ssh-keygen jenkins" before proceeding" - exit 1 -fi - -# Setup sudo -JENKINS_SUDO=/etc/sudoers.d/jenkins -cat > $JENKINS_SUDO < $JENKINS_GITCONF < - - 4 - Jenkins - jenkins@rcb.me - -EOF - -# Add build numbers -JOBS=`ls jobs` -for job in ${JOBS// / }; do - if [ ! -e jobs/$job/nextBuildNumber ]; then - echo 1 > jobs/$job/nextBuildNumber - fi -done - -# Set ownership to jenkins -chown -R jenkins $CUR_DIR - -# Make sure this directory is accessible to jenkins -if ! su -c "ls $CUR_DIR" jenkins; then - echo "Your devstack directory is not accessible by jenkins." - echo "There is a decent chance you are trying to run this from a directory in /root." - echo "If so, try moving devstack elsewhere (eg. /opt/devstack)." - exit 1 -fi - -# Move aside old jobs, if present -if [ ! -h /var/lib/jenkins/jobs ]; then - echo "Installing jobs symlink" - if [ -d /var/lib/jenkins/jobs ]; then - mv /var/lib/jenkins/jobs /var/lib/jenkins/jobs.old - fi -fi - -# Set up jobs symlink -rm -f /var/lib/jenkins/jobs -ln -s $CUR_DIR/jobs /var/lib/jenkins/jobs - -# List of plugins -PLUGINS=http://hudson-ci.org/downloads/plugins/build-timeout/1.6/build-timeout.hpi,http://mirrors.jenkins-ci.org/plugins/git/1.1.12/git.hpi,http://hudson-ci.org/downloads/plugins/global-build-stats/1.2/global-build-stats.hpi,http://hudson-ci.org/downloads/plugins/greenballs/1.10/greenballs.hpi,http://download.hudson-labs.org/plugins/console-column-plugin/1.0/console-column-plugin.hpi - -# Configure plugins -for plugin in ${PLUGINS//,/ }; do - name=`basename $plugin` - dest=/var/lib/jenkins/plugins/$name - if [ ! -e $dest ]; then - curl -L $plugin -o $dest - fi -done - -# Restart jenkins -/etc/init.d/jenkins stop || true -/etc/init.d/jenkins start diff --git a/tools/jenkins/jenkins_home/clean.sh b/tools/jenkins/jenkins_home/clean.sh deleted file mode 100755 index eb03022..0000000 --- a/tools/jenkins/jenkins_home/clean.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -# This script is not yet for general consumption. - -set -o errexit - -if [ ! "$FORCE" = "yes" ]; then - echo "FORCE not set to 'yes'. Make sure this is something you really want to do. Exiting." - exit 1 -fi - -virsh list | cut -d " " -f1 | grep -v "-" | egrep -e "[0-9]" | xargs -n 1 virsh destroy || true -virsh net-list | grep active | cut -d " " -f1 | xargs -n 1 virsh net-destroy || true -killall dnsmasq || true -if [ "$CLEAN" = "yes" ]; then - rm -rf jobs -fi -rm /var/lib/jenkins/jobs -git checkout -f -git fetch -git merge origin/jenkins -./build_jenkins.sh diff --git a/tools/jenkins/jenkins_home/jobs/diablo-kvm_ha/config.xml b/tools/jenkins/jenkins_home/jobs/diablo-kvm_ha/config.xml deleted file mode 100644 index 94c51f5..0000000 --- a/tools/jenkins/jenkins_home/jobs/diablo-kvm_ha/config.xml +++ /dev/null @@ -1,82 +0,0 @@ - - - - - false - - - - - RC - - - - - - - - 2 - - - origin - +refs/heads/*:refs/remotes/origin/* - git://github.com/cloudbuilders/devstack.git - - - - - master - - - false - false - false - false - false - false - false - - Default - - - - - - - false - - - true - false - false - false - - false - - - ADAPTER - - euca - floating_ips - - - - - - sed -i 's/) 2>&1 | tee "${LOGFILE}"/)/' stack.sh - - - set -o errexit -cd tools/jenkins -sudo ./build_configuration.sh $EXECUTOR_NUMBER kvm $ADAPTER "$RC" - - - set -o errexit -cd tools/jenkins -./run_test.sh $EXECUTOR_NUMBER $ADAPTER $RC "$RC" - - - - - false - diff --git a/tools/jenkins/jenkins_home/jobs/diablo-kvm_ha/configurations/axis-ADAPTER/euca/config.xml b/tools/jenkins/jenkins_home/jobs/diablo-kvm_ha/configurations/axis-ADAPTER/euca/config.xml deleted file mode 100644 index 0be70a5..0000000 --- a/tools/jenkins/jenkins_home/jobs/diablo-kvm_ha/configurations/axis-ADAPTER/euca/config.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - false - - - false - false - false - false - - false - - - - \ No newline at end of file diff --git a/tools/jenkins/jenkins_home/jobs/diablo-kvm_ha/configurations/axis-ADAPTER/floatingips/config.xml b/tools/jenkins/jenkins_home/jobs/diablo-kvm_ha/configurations/axis-ADAPTER/floatingips/config.xml deleted file mode 100644 index 0be70a5..0000000 --- a/tools/jenkins/jenkins_home/jobs/diablo-kvm_ha/configurations/axis-ADAPTER/floatingips/config.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - false - - - false - false - false - false - - false - - - - \ No newline at end of file diff --git a/tools/jenkins/jenkins_home/jobs/diablo-xs_ha/config.xml b/tools/jenkins/jenkins_home/jobs/diablo-xs_ha/config.xml deleted file mode 100644 index d0fa6af..0000000 --- a/tools/jenkins/jenkins_home/jobs/diablo-xs_ha/config.xml +++ /dev/null @@ -1,88 +0,0 @@ - - - - In order for this to work, you must create a /var/lib/jenkins/xenrc file as described in README.md - false - - - - - RC - - - - - - - - 2 - - - origin - +refs/heads/*:refs/remotes/origin/* - git://github.com/cloudbuilders/devstack.git - - - - - master - - - false - false - false - false - false - false - false - - Default - - - - - - - false - - - true - false - false - false - - false - - - ADAPTER - - euca - floating_ips - - - - - - sed -i 's/) 2>&1 | tee "${LOGFILE}"/)/' stack.sh - - - set -o errexit -cd tools/jenkins -sudo ./build_configuration.sh $EXECUTOR_NUMBER xs $ADAPTER "$RC" - - - #!/bin/bash -set -o errexit -set -o xtrace - -. localrc - -# Unlike kvm, ssh to the xen host to run tests, in case the test instance is launch with a host only network -ssh root@$XEN_IP "cd devstack && . localrc && cd tools/jenkins && ./run_test.sh $EXECUTOR_NUMBER $ADAPTER '$RC'" - - - - - - true - diff --git a/tools/jenkins/jenkins_home/print_summary.py b/tools/jenkins/jenkins_home/print_summary.py deleted file mode 100755 index 1d71a4a..0000000 --- a/tools/jenkins/jenkins_home/print_summary.py +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/python -import urllib -import json -import sys - - -def print_usage(): - print "Usage: %s [jenkins_url (eg. http://50.56.12.202:8080/)]"\ - % sys.argv[0] - sys.exit() - - -def fetch_blob(url): - return json.loads(urllib.urlopen(url + '/api/json').read()) - - -if len(sys.argv) < 2: - print_usage() - -BASE_URL = sys.argv[1] - -root = fetch_blob(BASE_URL) -results = {} -for job_url in root['jobs']: - job = fetch_blob(job_url['url']) - if job.get('activeConfigurations'): - (tag, name) = job['name'].split('-') - if not results.get(tag): - results[tag] = {} - if not results[tag].get(name): - results[tag][name] = [] - - for config_url in job['activeConfigurations']: - config = fetch_blob(config_url['url']) - - log_url = '' - if config.get('lastBuild'): - log_url = config['lastBuild']['url'] + 'console' - - results[tag][name].append({'test': config['displayName'], - 'status': config['color'], - 'logUrl': log_url, - 'healthReport': config['healthReport']}) - -print json.dumps(results) diff --git a/tools/jenkins/run_test.sh b/tools/jenkins/run_test.sh deleted file mode 100755 index 4649563..0000000 --- a/tools/jenkins/run_test.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash - -EXECUTOR_NUMBER=$1 -ADAPTER=$2 -RC=$3 - -function usage() { - echo "Usage: $0 - Run a test" - echo "" - echo "$0 [EXECUTOR_NUMBER] [ADAPTER] [RC (optional)]" - exit 1 -} - -# Validate inputs -if [[ "$EXECUTOR_NUMBER" = "" || "$ADAPTER" = "" ]]; then - usage -fi - -# Execute configuration script -cd adapters && ./$ADAPTER.sh $EXECUTOR_NUMBER $ADAPTER "$RC" diff --git a/tools/rfc.sh b/tools/rfc.sh deleted file mode 100755 index 0bc1531..0000000 --- a/tools/rfc.sh +++ /dev/null @@ -1,145 +0,0 @@ -#!/bin/sh -e -# Copyright (c) 2010-2011 Gluster, Inc. -# This initial version of this file was taken from the source tree -# of GlusterFS. It was not directly attributed, but is assumed to be -# Copyright (c) 2010-2011 Gluster, Inc and release GPLv3 -# Subsequent modifications are Copyright (c) 2011 OpenStack, LLC. -# -# GlusterFS is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published -# by the Free Software Foundation; either version 3 of the License, -# or (at your option) any later version. -# -# GlusterFS is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see -# . - - -branch="master"; - -set_hooks_commit_msg() -{ - top_dir=`git rev-parse --show-toplevel` - f="${top_dir}/.git/hooks/commit-msg"; - u="https://review.openstack.org/tools/hooks/commit-msg"; - - if [ -x "$f" ]; then - return; - fi - - curl -o $f $u || wget -O $f $u; - - chmod +x $f; - - GIT_EDITOR=true git commit --amend -} - -add_remote() -{ - username=$1 - project=$2 - - echo "No remote set, testing ssh://$username@review.openstack.org:29418" - if project_list=`ssh -p29418 -o StrictHostKeyChecking=no $username@review.openstack.org gerrit ls-projects 2>/dev/null` - then - echo "$username@review.openstack.org:29418 worked." - if echo $project_list | grep $project >/dev/null - then - echo "Creating a git remote called gerrit that maps to:" - echo " ssh://$username@review.openstack.org:29418/$project" - git remote add gerrit ssh://$username@review.openstack.org:29418/$project - else - echo "The current project name, $project, is not a known project." - echo "Please either reclone from github/gerrit or create a" - echo "remote named gerrit that points to the intended project." - return 1 - fi - - return 0 - fi - return 1 -} - -check_remote() -{ - if ! git remote | grep gerrit >/dev/null 2>&1 - then - origin_project=`git remote show origin | grep 'Fetch URL' | perl -nle '@fields = split(m|[:/]|); $len = $#fields; print $fields[$len-1], "/", $fields[$len];'` - if add_remote $USERNAME $origin_project - then - return 0 - else - echo "Your local name doesn't work on Gerrit." - echo -n "Enter Gerrit username (same as launchpad): " - read gerrit_user - if add_remote $gerrit_user $origin_project - then - return 0 - else - echo "Can't infer where gerrit is - please set a remote named" - echo "gerrit manually and then try again." - echo - echo "For more information, please see:" - echo "\thttp://wiki.openstack.org/GerritWorkflow" - exit 1 - fi - fi - fi -} - -rebase_changes() -{ - git fetch; - - GIT_EDITOR=true git rebase -i origin/$branch || exit $?; -} - - -assert_diverge() -{ - if ! git diff origin/$branch..HEAD | grep -q . - then - echo "No changes between the current branch and origin/$branch." - exit 1 - fi -} - - -main() -{ - set_hooks_commit_msg; - - check_remote; - - rebase_changes; - - assert_diverge; - - bug=$(git show --format='%s %b' | perl -nle 'if (/\b([Bb]ug|[Ll][Pp])\s*[#:]?\s*(\d+)/) {print "$2"; exit}') - - bp=$(git show --format='%s %b' | perl -nle 'if (/\b([Bb]lue[Pp]rint|[Bb][Pp])\s*[#:]?\s*([0-9a-zA-Z-_]+)/) {print "$2"; exit}') - - if [ "$DRY_RUN" = 1 ]; then - drier='echo -e Please use the following command to send your commits to review:\n\n' - else - drier= - fi - - local_branch=`git branch | grep -Ei "\* (.*)" | cut -f2 -d' '` - if [ -z "$bug" ]; then - if [ -z "$bp" ]; then - $drier git push gerrit HEAD:refs/for/$branch/$local_branch; - else - $drier git push gerrit HEAD:refs/for/$branch/bp/$bp; - fi - else - $drier git push gerrit HEAD:refs/for/$branch/bug/$bug; - fi -} - -main "$@" diff --git a/tools/uec/meta.py b/tools/uec/meta.py deleted file mode 100644 index 5b845d8..0000000 --- a/tools/uec/meta.py +++ /dev/null @@ -1,29 +0,0 @@ -import sys -from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler -from SimpleHTTPServer import SimpleHTTPRequestHandler - -def main(host, port, HandlerClass = SimpleHTTPRequestHandler, - ServerClass = HTTPServer, protocol="HTTP/1.0"): - """simple http server that listens on a give address:port""" - - server_address = (host, port) - - HandlerClass.protocol_version = protocol - httpd = ServerClass(server_address, HandlerClass) - - sa = httpd.socket.getsockname() - print "Serving HTTP on", sa[0], "port", sa[1], "..." - httpd.serve_forever() - -if __name__ == '__main__': - if sys.argv[1:]: - address = sys.argv[1] - else: - address = '0.0.0.0' - if ':' in address: - host, port = address.split(':') - else: - host = address - port = 8080 - - main(host, int(port)) diff --git a/tools/warm_apts_and_pips_for_uec.sh b/tools/warm_apts_and_pips_for_uec.sh deleted file mode 100755 index ec7e916..0000000 --- a/tools/warm_apts_and_pips_for_uec.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/usr/bin/env bash - -# Echo commands -set -o xtrace - -# Exit on error to stop unexpected errors -set -o errexit - -# Keep track of the current directory -TOOLS_DIR=$(cd $(dirname "$0") && pwd) -TOP_DIR=`cd $TOOLS_DIR/..; pwd` - -# Change dir to top of devstack -cd $TOP_DIR - -# Echo usage -usage() { - echo "Cache OpenStack dependencies on a uec image to speed up performance." - echo "" - echo "Usage: $0 [full path to raw uec base image]" -} - -# Make sure this is a raw image -if ! qemu-img info $1 | grep -q "file format: raw"; then - usage - exit 1 -fi - -# Make sure we are in the correct dir -if [ ! -d files/apts ]; then - echo "Please run this script from devstack/tools/" - exit 1 -fi - -# Mount the image -STAGING_DIR=/tmp/`echo $1 | sed "s/\//_/g"`.stage -mkdir -p $STAGING_DIR -umount $STAGING_DIR || true -sleep 1 -mount -t ext4 -o loop $1 $STAGING_DIR - -# Make sure that base requirements are installed -cp /etc/resolv.conf $STAGING_DIR/etc/resolv.conf - -# Perform caching on the base image to speed up subsequent runs -chroot $STAGING_DIR apt-get update -chroot $STAGING_DIR apt-get install -y --download-only `cat files/apts/* | grep NOPRIME | cut -d\# -f1` -chroot $STAGING_DIR apt-get install -y --force-yes `cat files/apts/* | grep -v NOPRIME | cut -d\# -f1` || true -mkdir -p $STAGING_DIR/var/cache/pip -PIP_DOWNLOAD_CACHE=/var/cache/pip chroot $STAGING_DIR pip install `cat files/pips/*` || true - -# Unmount -umount $STAGING_DIR diff --git a/tools/xen/README.md b/tools/xen/README.md deleted file mode 100644 index 63350ea..0000000 --- a/tools/xen/README.md +++ /dev/null @@ -1,70 +0,0 @@ -Getting Started With XenServer 5.6 and Devstack -=============================================== -The purpose of the code in this directory it to help developers bootstrap -a XenServer 5.6 + Openstack development environment. This file gives -some pointers on how to get started. - -Step 1: Install Xenserver ------------------------- -Install XenServer 5.6 on a clean box. You can get XenServer by signing -up for an account on citrix.com, and then visiting: -https://www.citrix.com/English/ss/downloads/details.asp?downloadId=2311504&productId=683148 - -Here are some sample Xenserver network settings for when you are just -getting started (I use settings like this with a lappy + cheap wifi router): - -* XenServer Host IP: 192.168.1.10 -* XenServer Netmask: 255.255.255.0 -* XenServer Gateway: 192.168.1.1 -* XenServer DNS: 192.168.1.1 - -Step 2: Prepare DOM0 -------------------- -At this point, your server is missing some critical software that you will -need to run devstack (like git). Do this to install required software: - - wget --no-check-certificate https://github.com/cloudbuilders/devstack/raw/xen/tools/xen/prepare_dom0.sh - chmod 755 prepare_dom0.sh - ./prepare_dom0.sh - -This script will also clone devstack in /root/devstack - -Step 3: Configure your localrc ------------------------------ -Devstack uses a localrc for user-specific configuration. Note that -the XENAPI_PASSWORD must be your dom0 root password. -Of course, use real passwords if this machine is exposed. - - cat > /root/devstack/localrc <> /etc/sysconfig/network -fi - -# Also, enable ip forwarding in rc.local, since the above trick isn't working -if ! grep -q "echo 1 >/proc/sys/net/ipv4/ip_forward" /etc/rc.local; then - echo "echo 1 >/proc/sys/net/ipv4/ip_forward" >> /etc/rc.local -fi - -# Enable ip forwarding at runtime as well -echo 1 > /proc/sys/net/ipv4/ip_forward - -# Directory where we stage the build -STAGING_DIR=$TOP_DIR/stage - -# 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 -if [ ! -d $STAGING_DIR/etc ]; then - echo "Stage is not properly set up!" - exit 1 -fi - -# Directory where our conf files are stored -FILES_DIR=$TOP_DIR/files -TEMPLATES_DIR=$TOP_DIR/templates - -# Directory for supporting script files -SCRIPT_DIR=$TOP_DIR/scripts - -# Version of ubuntu with which we are working -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-//"` - -# 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) -cp /etc/resolv.conf $STAGING_DIR/etc/resolv.conf - -# Copy over devstack -rm -f /tmp/devstack.tar -tar --exclude='stage' --exclude='xen/xvas' --exclude='xen/nova' -cvf /tmp/devstack.tar $TOP_DIR/../../../devstack -cd $STAGING_DIR/opt/stack/ -tar xf /tmp/devstack.tar -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 - -# Directory for xvas -XVA_DIR=$TOP_DIR/xvas - -# Create xva dir -mkdir -p $XVA_DIR - -# Clean nova if desired -if [ "$CLEAN" = "1" ]; then - rm -rf $TOP_DIR/nova -fi - -# Checkout nova -if [ ! -d $TOP_DIR/nova ]; then - git clone git://github.com/cloudbuilders/nova.git - git checkout diablo -fi - -# Run devstack on launch -cat <$STAGING_DIR/etc/rc.local -GUEST_PASSWORD=$GUEST_PASSWORD STAGING_DIR=/ DO_TGZ=0 bash /opt/stack/devstack/tools/xen/prepare_guest.sh -su -c "/opt/stack/run.sh > /opt/stack/run.sh.log" stack -exit 0 -EOF - -# 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 - -# 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 - - -# Shutdown previous runs -DO_SHUTDOWN=${DO_SHUTDOWN:-1} -if [ "$DO_SHUTDOWN" = "1" ]; then - # Shutdown all domU's that created previously - xe vm-list --minimal name-label="$LABEL" | xargs ./scripts/uninstall-os-vpx.sh - - # Destroy any instances that were launched - for uuid in `xe vm-list | grep -1 instance | grep uuid | sed "s/.*\: //g"`; do - echo "Shutting down nova instance $uuid" - xe vm-unpause uuid=$uuid || true - xe vm-shutdown uuid=$uuid - xe vm-destroy uuid=$uuid - done - - # Destroy orphaned vdis - for uuid in `xe vdi-list | grep -1 Glance | grep uuid | sed "s/.*\: //g"`; do - xe vdi-destroy uuid=$uuid - done -fi - -# Path to head xva. By default keep overwriting the same one to save space -USE_SEPARATE_XVAS=${USE_SEPARATE_XVAS:-0} -if [ "$USE_SEPARATE_XVAS" = "0" ]; then - XVA=$XVA_DIR/$UBUNTU_VERSION.xva -else - XVA=$XVA_DIR/$UBUNTU_VERSION.$GUEST_NAME.xva -fi - -# Clean old xva. In the future may not do this every time. -rm -f $XVA - -# Configure the hostname -echo $GUEST_NAME > $STAGING_DIR/etc/hostname - -# Hostname must resolve for rabbit -cat <$STAGING_DIR/etc/hosts -$MGT_IP $GUEST_NAME -127.0.0.1 localhost localhost.localdomain -EOF - -# Configure the network -INTERFACES=$STAGING_DIR/etc/network/interfaces -cp $TEMPLATES_DIR/interfaces.in $INTERFACES -sed -e "s,@ETH1_IP@,$VM_IP,g" -i $INTERFACES -sed -e "s,@ETH1_NETMASK@,$VM_NETMASK,g" -i $INTERFACES -sed -e "s,@ETH2_IP@,$MGT_IP,g" -i $INTERFACES -sed -e "s,@ETH2_NETMASK@,$MGT_NETMASK,g" -i $INTERFACES -sed -e "s,@ETH3_IP@,$PUB_IP,g" -i $INTERFACES -sed -e "s,@ETH3_NETMASK@,$PUB_NETMASK,g" -i $INTERFACES - -# Gracefully cp only if source file/dir exists -function cp_it { - if [ -e $1 ] || [ -d $1 ]; then - cp -pRL $1 $2 - fi -} - -# Copy over your ssh keys and env if desired -COPYENV=${COPYENV:-1} -if [ "$COPYENV" = "1" ]; then - cp_it ~/.ssh $STAGING_DIR/opt/stack/.ssh - cp_it ~/.ssh/id_rsa.pub $STAGING_DIR/opt/stack/.ssh/authorized_keys - cp_it ~/.gitconfig $STAGING_DIR/opt/stack/.gitconfig - cp_it ~/.vimrc $STAGING_DIR/opt/stack/.vimrc - cp_it ~/.bashrc $STAGING_DIR/opt/stack/.bashrc -fi - -# Configure run.sh -cat <$STAGING_DIR/opt/stack/run.sh -#!/bin/bash -cd /opt/stack/devstack -killall screen -UPLOAD_LEGACY_TTY=yes HOST_IP=$PUB_IP VIRT_DRIVER=xenserver FORCE=yes MULTI_HOST=1 $STACKSH_PARAMS ./stack.sh -EOF -chmod 755 $STAGING_DIR/opt/stack/run.sh - -# Create xva -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 - -# Start guest -$TOP_DIR/scripts/install-os-vpx.sh -f $XVA -v $VM_BR -m $MGT_BR -p $PUB_BR - -# If we have copied our ssh credentials, use ssh to monitor while the installation runs -WAIT_TILL_LAUNCH=${WAIT_TILL_LAUNCH:-1} -if [ "$WAIT_TILL_LAUNCH" = "1" ] && [ -e ~/.ssh/id_rsa.pub ] && [ "$COPYENV" = "1" ]; then - # Done creating the container, let's tail the log - echo - echo "=============================================================" - echo " -- YAY! --" - echo "=============================================================" - echo - echo "We're done launching the vm, about to start tailing the" - echo "stack.sh log. It will take a second or two to start." - echo - echo "Just CTRL-C at any time to stop tailing." - - set +o xtrace - - while ! ssh -q stack@$PUB_IP "[ -e run.sh.log ]"; do - sleep 1 - done - - ssh stack@$PUB_IP 'tail -f run.sh.log' & - - TAIL_PID=$! - - function kill_tail() { - kill $TAIL_PID - exit 1 - } - - # Let Ctrl-c kill tail and exit - trap kill_tail SIGINT - - echo "Waiting stack.sh to finish..." - while ! ssh -q stack@$PUB_IP "grep -q 'stack.sh completed in' run.sh.log"; do - sleep 1 - done - - kill $TAIL_PID - - if ssh -q stack@$PUB_IP "grep -q 'stack.sh failed' run.sh.log"; then - exit 1 - fi - echo "" - echo "Finished - Zip-a-dee Doo-dah!" - echo "You can then visit the OpenStack Dashboard" - echo "at http://$PUB_IP, and contact other services at the usual ports." -else - echo "################################################################################" - echo "" - echo "All Finished!" - echo "Now, you can monitor the progress of the stack.sh installation by " - echo "tailing /opt/stack/run.sh.log from within your domU." - echo "" - echo "ssh into your domU now: 'ssh stack@$PUB_IP' using your password" - echo "and then do: 'tail -f /opt/stack/run.sh.log'" - echo "" - echo "When the script completes, you can then visit the OpenStack Dashboard" - echo "at http://$PUB_IP, and contact other services at the usual ports." - -fi diff --git a/tools/xen/build_domU_multi.sh b/tools/xen/build_domU_multi.sh deleted file mode 100755 index 130bec5..0000000 --- a/tools/xen/build_domU_multi.sh +++ /dev/null @@ -1,35 +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_domU { - GUEST_NAME=$1 PUB_IP=$2 MGT_IP=$3 DO_SHUTDOWN=$4 TERMINATE=$TERMINATE STACKSH_PARAMS="$COMMON_VARS $5" ./build_domU.sh -} - -# Launch the head node - headnode uses a non-ip domain name, -# because rabbit won't launch with an ip addr hostname :( -build_domU HEADNODE $HEAD_PUB_IP $HEAD_MGT_IP 1 "ENABLED_SERVICES=g-api,g-reg,key,n-api,n-sch,n-vnc,horizon,mysql,rabbit" - -# Wait till the head node is up -while ! curl -L http://$HEAD_PUB_IP | grep -q username; do - echo "Waiting for head node ($HEAD_PUB_IP) to start..." - sleep 5 -done - -# Build the HA compute host -build_domU $COMPUTE_PUB_IP $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/prepare_dom0.sh b/tools/xen/prepare_dom0.sh deleted file mode 100755 index ce16ada..0000000 --- a/tools/xen/prepare_dom0.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh -set -o xtrace -set -o errexit - -# Install basics for vi and git -yum -y --enablerepo=base install gcc make vim-enhanced zlib-devel openssl-devel - -# Simple but usable vimrc -if [ ! -e /root/.vimrc ]; then - cat > /root/.vimrc <$STAGING_DIR/etc/apt/sources.list -deb http://us.archive.ubuntu.com/ubuntu/ oneiric main restricted -deb-src http://us.archive.ubuntu.com/ubuntu/ oneiric main restricted -deb http://us.archive.ubuntu.com/ubuntu/ oneiric-updates main restricted -deb-src http://us.archive.ubuntu.com/ubuntu/ oneiric-updates main restricted -deb http://us.archive.ubuntu.com/ubuntu/ oneiric universe -deb http://us.archive.ubuntu.com/ubuntu/ oneiric-updates universe -deb http://us.archive.ubuntu.com/ubuntu/ oneiric multiverse -deb http://us.archive.ubuntu.com/ubuntu/ oneiric-updates multiverse -EOF - -# Install basics -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 curl wget ssh openssh-server python-pip git vim-nox sudo -chroot $STAGING_DIR pip install xenapi - -# Install guest utilities -XEGUEST=xe-guest-utilities_5.6.100-651_amd64.deb -wget http://images.ansolabs.com/xen/$XEGUEST -O $XEGUEST -cp $XEGUEST $STAGING_DIR/root -chroot $STAGING_DIR dpkg -i /root/$XEGUEST -chroot $STAGING_DIR update-rc.d -f xe-linux-distribution remove -chroot $STAGING_DIR update-rc.d xe-linux-distribution defaults - -# Make a small cracklib dictionary, so that passwd still works, but we don't -# have the big dictionary. -mkdir -p $STAGING_DIR/usr/share/cracklib -echo a | chroot $STAGING_DIR cracklib-packer - -# Make /etc/shadow, and set the root password -chroot $STAGING_DIR "pwconv" -echo "root:$GUEST_PASSWORD" | chroot $STAGING_DIR chpasswd - -# Put the VPX into UTC. -rm -f $STAGING_DIR/etc/localtime - -# Add stack user -chroot $STAGING_DIR groupadd libvirtd -chroot $STAGING_DIR useradd stack -s /bin/bash -d /opt/stack -G libvirtd -echo stack:$GUEST_PASSWORD | chroot $STAGING_DIR chpasswd -echo "stack ALL=(ALL) NOPASSWD: ALL" >> $STAGING_DIR/etc/sudoers - -# Give ownership of /opt/stack to stack user -chroot $STAGING_DIR chown -R stack /opt/stack - -# Make our ip address hostnames look nice at the command prompt -echo "export PS1='${debian_chroot:+($debian_chroot)}\\u@\\H:\\w\\$ '" >> $STAGING_DIR/opt/stack/.bashrc -echo "export PS1='${debian_chroot:+($debian_chroot)}\\u@\\H:\\w\\$ '" >> $STAGING_DIR/root/.bashrc -echo "export PS1='${debian_chroot:+($debian_chroot)}\\u@\\H:\\w\\$ '" >> $STAGING_DIR/etc/profile - -function setup_vimrc { - if [ ! -e $1 ]; then - # Simple but usable vimrc - cat > $1 <&2 - exit 1 - else - echo "$dest_sr" - fi -} - - -find_network() -{ - result=$(xe_min network-list bridge="$1") - if [ "$result" = "" ] - then - result=$(xe_min network-list name-label="$1") - fi - echo "$result" -} - - -find_template() -{ - xe_min template-list other-config:os-vpx=true -} - - -renumber_system_disk() -{ - local v="$1" - local vdi_uuid=$(xe_min vbd-list vm-uuid="$v" type=Disk userdevice=xvda \ - params=vdi-uuid) - if [ "$vdi_uuid" ] - then - local vbd_uuid=$(xe_min vbd-list vm-uuid="$v" vdi-uuid="$vdi_uuid") - xe vbd-destroy uuid="$vbd_uuid" - local new_vbd_uuid=$(xe vbd-create vm-uuid="$v" vdi-uuid="$vdi_uuid" \ - device=0 bootable=true type=Disk) - xe vbd-param-set other-config:owner uuid="$new_vbd_uuid" - fi -} - - -create_vif() -{ - xe vif-create vm-uuid="$1" network-uuid="$2" device="$3" -} - -create_gi_vif() -{ - local v="$1" - # Note that we've made the outbound device eth1, so that it comes up after - # the guest installer VIF, which means that the outbound one wins in terms - # of gateway. - local gi_network_uuid=$(xe_min network-list \ - other-config:is_guest_installer_network=true) - create_vif "$v" "$gi_network_uuid" "0" >/dev/null -} - -create_vm_vif() -{ - local v="$1" - echo "Installing management interface on $BRIDGE_V." - local out_network_uuid=$(find_network "$BRIDGE_V") - create_vif "$v" "$out_network_uuid" "1" >/dev/null -} - -create_management_vif() -{ - local v="$1" - echo "Installing management interface on $BRIDGE_M." - local out_network_uuid=$(find_network "$BRIDGE_M") - create_vif "$v" "$out_network_uuid" "2" >/dev/null -} - - -# This installs the interface for public traffic, only if a bridge is specified -# The interface is not configured at this stage, but it will be, once the admin -# tasks are complete for the services of this VPX -create_public_vif() -{ - local v="$1" - if [[ -z $BRIDGE_P ]] - then - echo "Skipping installation of interface for public traffic." - else - echo "Installing public interface on $BRIDGE_P." - pub_network_uuid=$(find_network "$BRIDGE_P") - create_vif "$v" "$pub_network_uuid" "3" >/dev/null - fi -} - - -label_system_disk() -{ - local v="$1" - local vdi_uuid=$(xe_min vbd-list vm-uuid="$v" type=Disk userdevice=0 \ - params=vdi-uuid) - xe vdi-param-set \ - name-label="$NAME system disk" \ - other-config:os-vpx=true \ - uuid=$vdi_uuid -} - - -create_data_disk() -{ - local v="$1" - - local sys_vdi_uuid=$(xe_min vbd-list vm-uuid="$v" type=Disk params=vdi-uuid) - local data_vdi_uuid=$(xe_min vdi-list other-config:os-vpx-data=true) - - if echo "$data_vdi_uuid" | grep -q , - then - echo "Multiple data disks found -- assuming that you want a new one." - data_vdi_uuid="" - else - data_in_use=$(xe_min vbd-list vdi-uuid="$data_vdi_uuid") - if [ "$data_in_use" != "" ] - then - echo "Data disk already in use -- will create another one." - data_vdi_uuid="" - fi - fi - - if [ "$data_vdi_uuid" = "" ] - then - echo -n "Creating new data disk ($DATA_VDI_SIZE)... " - sr_uuid=$(xe_min vdi-list params=sr-uuid uuid="$sys_vdi_uuid") - data_vdi_uuid=$(xe vdi-create name-label="$NAME data disk" \ - sr-uuid="$sr_uuid" \ - type=user \ - virtual-size="$DATA_VDI_SIZE") - xe vdi-param-set \ - other-config:os-vpx-data=true \ - uuid="$data_vdi_uuid" - dom0_uuid=$(xe_min vm-list is-control-domain=true) - vbd_uuid=$(xe vbd-create device=autodetect type=Disk \ - vdi-uuid="$data_vdi_uuid" vm-uuid="$dom0_uuid") - xe vbd-plug uuid=$vbd_uuid - dev=$(xe_min vbd-list params=device uuid=$vbd_uuid) - mke2fs -q -j -m0 /dev/$dev - e2label /dev/$dev vpxstate - xe vbd-unplug uuid=$vbd_uuid - xe vbd-destroy uuid=$vbd_uuid - else - echo -n "Attaching old data disk... " - fi - vbd_uuid=$(xe vbd-create device=2 type=Disk \ - vdi-uuid="$data_vdi_uuid" vm-uuid="$v") - xe vbd-param-set other-config:os-vpx-data=true uuid=$vbd_uuid - echo "done." -} - - -set_kernel_params() -{ - local v="$1" - 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" != "" ] - then - echo "Passing Geppetto args to VPX: $args." - xe vm-param-set PV-args="$args" uuid="$v" - fi -} - - -set_memory() -{ - local v="$1" - if [ "$RAM" != "" ] - then - echo "Setting RAM to $RAM MiB." - [ "$BALLOONING" == 1 ] && RAM_MIN=$(($RAM / 2)) || RAM_MIN=$RAM - xe vm-memory-limits-set static-min=16MiB static-max=${RAM}MiB \ - dynamic-min=${RAM_MIN}MiB dynamic-max=${RAM}MiB \ - uuid="$v" - fi -} - - -# Make the VM auto-start on server boot. -set_auto_start() -{ - local v="$1" - xe vm-param-set uuid="$v" other-config:auto_poweron=true -} - - -set_all() -{ - local v="$1" - set_kernel_params "$v" - set_memory "$v" - set_auto_start "$v" - label_system_disk "$v" - create_gi_vif "$v" - create_vm_vif "$v" - create_management_vif "$v" - create_public_vif "$v" -} - - -log_vifs() -{ - local v="$1" - - (IFS=, - for vif in $(xe_min vif-list vm-uuid="$v") - do - dev=$(xe_min vif-list uuid="$vif" params=device) - mac=$(xe_min vif-list uuid="$vif" params=MAC | sed -e 's/:/-/g') - echo "eth$dev has MAC $mac." - done - unset IFS) | sort -} - - -destroy_vifs() -{ - local v="$1" - IFS=, - for vif in $(xe_min vif-list vm-uuid="$v") - do - xe vif-destroy uuid="$vif" - done - unset IFS -} - - -get_params "$@" - -thisdir=$(dirname "$0") - -if [ "$FROM_TEMPLATE" ] -then - template_uuid=$(find_template) - name=$(xe_min template-list params=name-label uuid="$template_uuid") - echo -n "Cloning $name... " - vm_uuid=$(xe vm-clone vm="$template_uuid" new-name-label="$name") - xe vm-param-set is-a-template=false uuid="$vm_uuid" - echo $vm_uuid. - - destroy_vifs "$vm_uuid" - set_all "$vm_uuid" -else - if [ ! -f "$VPX_FILE" ] - then - # Search $thisdir/$VPX_FILE too. In particular, this is used when - # installing the VPX from the supp-pack, because we want to be able to - # invoke this script from the RPM and the firstboot script. - if [ -f "$thisdir/$VPX_FILE" ] - then - VPX_FILE="$thisdir/$VPX_FILE" - else - echo "$VPX_FILE does not exist." >&2 - exit 1 - fi - fi - - echo "Found OS-VPX File: $VPX_FILE. " - - dest_sr=$(get_dest_sr) - - echo -n "Installing $NAME... " - vm_uuid=$(xe vm-import filename=$VPX_FILE sr-uuid="$dest_sr") - echo $vm_uuid. - - renumber_system_disk "$vm_uuid" - - nl=$(xe_min vm-list params=name-label uuid=$vm_uuid) - xe vm-param-set \ - "name-label=${nl/ import/}" \ - other-config:os-vpx=true \ - uuid=$vm_uuid - - set_all "$vm_uuid" - create_data_disk "$vm_uuid" - - if [ "$AS_TEMPLATE" ] - then - xe vm-param-set uuid="$vm_uuid" is-a-template=true \ - other-config:instant=true - echo -n "Installing VPX from template... " - vm_uuid=$(xe vm-clone vm="$vm_uuid" new-name-label="${nl/ import/}") - xe vm-param-set is-a-template=false uuid="$vm_uuid" - echo "$vm_uuid." - fi -fi - - -log_vifs "$vm_uuid" - -echo -n "Starting VM... " -xe vm-start uuid=$vm_uuid -echo "done." - - -show_ip() -{ - ip_addr=$(echo "$1" | sed -n "s,^.*"$2"/ip: \([^;]*\).*$,\1,p") - echo -n "IP address for $3: " - if [ "$ip_addr" = "" ] - then - echo "did not appear." - else - echo "$ip_addr." - fi -} - - -if [ "$WAIT_FOR_NETWORK" ] -then - echo "Waiting for network configuration... " - i=0 - while [ $i -lt 600 ] - do - ip=$(xe_min vm-list params=networks uuid=$vm_uuid) - if [ "$ip" != "" ] - then - show_ip "$ip" "1" "$BRIDGE_M" - if [[ $BRIDGE_P ]] - then - show_ip "$ip" "2" "$BRIDGE_P" - fi - echo "Installation complete." - exit 0 - fi - sleep 10 - let i=i+1 - done -fi diff --git a/tools/xen/scripts/mkxva b/tools/xen/scripts/mkxva deleted file mode 100755 index dcdee61..0000000 --- a/tools/xen/scripts/mkxva +++ /dev/null @@ -1,365 +0,0 @@ -#!/bin/bash -# -# Copyright (c) 2011 Citrix Systems, Inc. -# Copyright 2011 OpenStack LLC. -# 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/uninstall-os-vpx.sh b/tools/xen/scripts/uninstall-os-vpx.sh deleted file mode 100755 index a82f3a0..0000000 --- a/tools/xen/scripts/uninstall-os-vpx.sh +++ /dev/null @@ -1,101 +0,0 @@ -#!/bin/bash -# -# Copyright (c) 2011 Citrix Systems, Inc. -# Copyright 2011 OpenStack LLC. -# 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. -# - -remove_data= -if [ "$1" = "--remove-data" ] -then - remove_data=1 -fi - -set -eu - -xe_min() -{ - local cmd="$1" - shift - /opt/xensource/bin/xe "$cmd" --minimal "$@" -} - -destroy_vdi() -{ - local vbd_uuid="$1" - local type=$(xe_min vbd-list uuid=$vbd_uuid params=type) - local dev=$(xe_min vbd-list uuid=$vbd_uuid params=userdevice) - local vdi_uuid=$(xe_min vbd-list uuid=$vbd_uuid params=vdi-uuid) - - if [ "$type" = 'Disk' ] && [ "$dev" != 'xvda' ] && [ "$dev" != '0' ] - then - echo -n "Destroying data disk... " - xe vdi-destroy uuid=$vdi_uuid - echo "done." - fi -} - -uninstall() -{ - local vm_uuid="$1" - local power_state=$(xe_min vm-list uuid=$vm_uuid params=power-state) - - if [ "$power_state" != "halted" ] - then - echo -n "Shutting down VM... " - xe vm-shutdown vm=$vm_uuid force=true - echo "done." - fi - - if [ "$remove_data" = "1" ] - then - for v in $(xe_min vbd-list vm-uuid=$vm_uuid | sed -e 's/,/ /g') - do - destroy_vdi "$v" - done - fi - - echo -n "Deleting VM... " - xe vm-uninstall vm=$vm_uuid force=true >/dev/null - echo "done." -} - -uninstall_template() -{ - local vm_uuid="$1" - - if [ "$remove_data" = "1" ] - then - for v in $(xe_min vbd-list vm-uuid=$vm_uuid | sed -e 's/,/ /g') - do - destroy_vdi "$v" - done - fi - - echo -n "Deleting template... " - xe template-uninstall template-uuid=$vm_uuid force=true >/dev/null - echo "done." -} - - -for u in $(xe_min vm-list other-config:os-vpx=true | sed -e 's/,/ /g') -do - uninstall "$u" -done - -for u in $(xe_min template-list other-config:os-vpx=true | sed -e 's/,/ /g') -do - uninstall_template "$u" -done 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/interfaces.in b/tools/xen/templates/interfaces.in deleted file mode 100644 index 49c3d68..0000000 --- a/tools/xen/templates/interfaces.in +++ /dev/null @@ -1,21 +0,0 @@ -auto lo -iface lo inet loopback - -auto eth0 -iface eth0 inet dhcp - -auto eth1 -iface eth1 inet static - address @ETH1_IP@ - netmask @ETH1_NETMASK@ -post-up ethtool -K eth1 tx off - -auto eth2 -iface eth2 inet static - address @ETH2_IP@ - netmask @ETH2_NETMASK@ - -auto eth3 -iface eth3 inet static - address @ETH3_IP@ - netmask @ETH3_NETMASK@ 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 8443dcb..0000000 --- a/tools/xen/templates/ova.xml.in +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - -