diff options
author | Stefan K. Berg <stefan.k.berg@ericsson.com> | 2015-04-23 17:06:18 +0200 |
---|---|---|
committer | Stefan K. Berg <stefan.k.berg@ericsson.com> | 2015-04-28 12:26:21 +0200 |
commit | 0bf60004aea7359f10efc6d0133c88e5c4f40dda (patch) | |
tree | 5fe37812af029b943fe680925bbf6b681c533532 /fuel/prototypes/libvirt/setup_vms | |
parent | e2b2d46756213fde3bca42a49b04e6a1e8792498 (diff) |
Auto deploy prototype #2
This is an evolvement of the libvirt deployer to make it fully
general, and it also add the concept of Deploy Environment
Adapter (dea), Deploy Hardware Adapter (dha) and a hardware
adapter plugin.
See the README.rst file for an introduction of how to start
experimenting with this concept in a libvirt setting.
Highlights:
- Can "xerox" an existing Fuel deploy
- Separates configuration for the deployment (DEA) and
the configuration for the hardware (DHA)
- Introduces an API to be implemented by hardware adapters
(a libvirt example adapter is included)
- Provides a verification tool "verify_dha.sh" to validate
DHA adapters against the DHA API.
See the TODO.txt file for things that can be worked on.
JIRA
Change-Id: I98ff665e6b63c6c3bc42bb6b65c1d2151359e374
Signed-off-by: Stefan K. Berg <stefan.k.berg@ericsson.com>
Diffstat (limited to 'fuel/prototypes/libvirt/setup_vms')
-rwxr-xr-x | fuel/prototypes/libvirt/setup_vms/apply_setup.sh | 61 | ||||
-rwxr-xr-x | fuel/prototypes/libvirt/setup_vms/dump_setup.sh | 59 | ||||
-rwxr-xr-x | fuel/prototypes/libvirt/setup_vms/setup-vm-host.sh | 16 |
3 files changed, 0 insertions, 136 deletions
diff --git a/fuel/prototypes/libvirt/setup_vms/apply_setup.sh b/fuel/prototypes/libvirt/setup_vms/apply_setup.sh deleted file mode 100755 index 1598d66..0000000 --- a/fuel/prototypes/libvirt/setup_vms/apply_setup.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/bash -############################################################################## -# Copyright (c) 2015 Ericsson AB and others. -# stefan.k.berg@ericsson.com -# jonas.bjurel@ericsson.com -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## - -error_exit () { - echo "$@" - exit 1 -} - -netdir='../examples/networks' -vmdir='../examples/vms' -tmpfile=/tmp/foo - -if [ ! -d $netdir ]; then - error_exit "No net directory $netdir" - exit 1 -elif [ ! -d $vmdir ]; then - error_exit "No VM directory $vmdir" - exit 1 -fi - -if [ $# -ne 2 ]; then - echo "Argument error." - echo "`basename $0` <path to storage dir> <size in GB of disk per VM>" - exit 1 -fi - -storagedir=$1 -size=$2 - -if [ ! -d $storagedir ]; then - error_exit "Could not find storagedir directory $storagedir" -fi - -# Create storage space and patch it in -for vm in $vmdir/* -do - storage=${storagedir}/`basename ${vm}`.raw - if [ -f ${storage} ]; then - error_exit "Storage already present: ${storage}" - fi - echo "Creating ${size} GB of storage in ${storage}" - fallocate -l ${size}G ${storage} || \ - error_exit "Could not create storage" - sed "s:<source file='disk.raw':<source file='${storage}':" $vm >$tmpfile - virsh define $tmpfile -done - -for net in $netdir/* -do - virsh net-define $net - virsh net-autostart `basename $net` - virsh net-start `basename $net` -done diff --git a/fuel/prototypes/libvirt/setup_vms/dump_setup.sh b/fuel/prototypes/libvirt/setup_vms/dump_setup.sh deleted file mode 100755 index b65cf31..0000000 --- a/fuel/prototypes/libvirt/setup_vms/dump_setup.sh +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/bash -############################################################################## -# Copyright (c) 2015 Ericsson AB and others. -# stefan.k.berg@ericsson.com -# jonas.bjurel@ericsson.com -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## - -netdir='../examples/networks' -vmdir='../examples/vms' - -if [ -d $netdir ]; then - echo "Net directory already present" - exit 1 -elif [ -d $vmdir ]; then - echo "VM directory already present" - exit 1 -fi - -mkdir -p $netdir -mkdir -p $vmdir - -# Check that no VM is up -if virsh list | egrep -q "fuel-master|controller|compute" ; then - echo "Can't dump while VMs are up:" - virsh list | egrep "fuel-master|controller|compute" - exit 1 -fi - -# Dump all networks in the fuell* namespace -for net in `virsh net-list --all | tail -n+3 | awk '{ print $1 }' | grep fuel` -do - virsh net-dumpxml $net > $netdir/$net -done - -# Dump all fuel-master, compute* and controller* VMs -for vm in `virsh list --all | tail -n+3 | awk '{ print $2 }' | egrep 'fuel-master|compute|controller'` -do - virsh dumpxml $vm > $vmdir/$vm -done - -# Remove all attached ISOs, generalize the rest of the setup -for vm in $vmdir/* -do - sed -i '/.iso/d' $vm - sed -i "s/<source file='.*raw'/<source file='disk.raw'/" $vm - sed -i '/<uuid/d' $vm - sed -i '/<mac/d' $vm -done - -# Generalize all nets -for net in $netdir/* -do - sed -i '/<uuid/d' $net - sed -i '/<mac/d' $net -done diff --git a/fuel/prototypes/libvirt/setup_vms/setup-vm-host.sh b/fuel/prototypes/libvirt/setup_vms/setup-vm-host.sh deleted file mode 100755 index 58ce19a..0000000 --- a/fuel/prototypes/libvirt/setup_vms/setup-vm-host.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -############################################################################## -# Copyright (c) 2015 Ericsson AB and others. -# stefan.k.berg@ericsson.com -# jonas.bjurel@ericsson.com -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## - -# Tools for installation on the libvirt server/base host -# -apt-get install -y libvirt-bin qemu-kvm tightvncserver virt-manager \ - sshpass fuseiso genisoimage blackbox xterm -restart libvirt-bin |