2 ##############################################################################
3 # Copyright (c) 2015 Ericsson AB and others.
4 # stefan.k.berg@ericsson.com
5 # jonas.bjurel@ericsson.com
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Apache License, Version 2.0
8 # which accompanies this distribution, and is available at
9 # http://www.apache.org/licenses/LICENSE-2.0
10 ##############################################################################
12 topdir=$(cd $(dirname $(readlink -f $BASH_SOURCE)); cd ..; pwd)
13 netdir=$topdir/conf/networks
14 vmdir=$topdir/conf/vms
15 vms="fuel-master controller1 compute4 compute5"
16 networks="fuel1 fuel2 fuel3 fuel4"
19 if [ "`whoami`" != "root" ]; then
20 error_exit "You need be root to run this script"
26 if [ `ls -1 $netdir/ | wc -l` -ne 0 ]; then
27 echo "There are files in $netdir already!"
29 elif [ `ls -1 $vmdir/ | wc -l` -ne 0 ]; then
30 echo "There are files in $vmdir already!"
35 # Check that no VM is up
38 if [ "`virsh domstate $vm`" == "running" ]; then
39 echo "Can't dump while VM are up: $vm"
44 # Dump all networks in the fuell* namespace
47 virsh net-dumpxml $net > $netdir/$net
50 # Dump all fuel-master, compute* and controller* VMs
53 virsh dumpxml $vm > $vmdir/$vm
56 # Remove all attached ISOs, generalize disk file
60 sed -i "s/<source file='.*raw'/<source file='disk.raw'/" $vm
66 sed -i '/<uuid/d' $net