From 0bf60004aea7359f10efc6d0133c88e5c4f40dda Mon Sep 17 00:00:00 2001 From: "Stefan K. Berg" Date: Thu, 23 Apr 2015 17:06:18 +0200 Subject: 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 --- .../deploy/examples/libvirt/tools/dump_setup.sh | 68 ++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100755 fuel/prototypes/deploy/examples/libvirt/tools/dump_setup.sh (limited to 'fuel/prototypes/deploy/examples/libvirt/tools/dump_setup.sh') diff --git a/fuel/prototypes/deploy/examples/libvirt/tools/dump_setup.sh b/fuel/prototypes/deploy/examples/libvirt/tools/dump_setup.sh new file mode 100755 index 0000000..cdd029f --- /dev/null +++ b/fuel/prototypes/deploy/examples/libvirt/tools/dump_setup.sh @@ -0,0 +1,68 @@ +#!/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 +############################################################################## + +topdir=$(cd $(dirname $(readlink -f $BASH_SOURCE)); cd ..; pwd) +netdir=$topdir/conf/networks +vmdir=$topdir/conf/vms +vms="fuel-master controller1 compute4 compute5" +networks="fuel1 fuel2 fuel3 fuel4" + + +if [ "`whoami`" != "root" ]; then + error_exit "You need be root to run this script" +fi + +mkdir -p $netdir +mkdir -p $vmdir + +if [ `ls -1 $netdir/ | wc -l` -ne 0 ]; then + echo "There are files in $netdir already!" + exit 1 +elif [ `ls -1 $vmdir/ | wc -l` -ne 0 ]; then + echo "There are files in $vmdir already!" + exit 1 +fi + + +# Check that no VM is up +for vm in $vms +do + if [ "`virsh domstate $vm`" == "running" ]; then + echo "Can't dump while VM are up: $vm" + exit 1 + fi +done + +# Dump all networks in the fuell* namespace +for net in $networks +do + virsh net-dumpxml $net > $netdir/$net +done + +# Dump all fuel-master, compute* and controller* VMs +for vm in $vms +do + virsh dumpxml $vm > $vmdir/$vm +done + +# Remove all attached ISOs, generalize disk file +for vm in $vmdir/* +do + sed -i '/.iso/d' $vm + sed -i "s/