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 netdir='../examples/networks'
13 vmdir='../examples/vms'
15 if [ -d $netdir ]; then
16 echo "Net directory already present"
18 elif [ -d $vmdir ]; then
19 echo "VM directory already present"
26 # Check that no VM is up
27 if virsh list | egrep -q "fuel-master|controller|compute" ; then
28 echo "Can't dump while VMs are up:"
29 virsh list | egrep "fuel-master|controller|compute"
33 # Dump all networks in the fuell* namespace
34 for net in `virsh net-list --all | tail -n+3 | awk '{ print $1 }' | grep fuel`
36 virsh net-dumpxml $net > $netdir/$net
39 # Dump all fuel-master, compute* and controller* VMs
40 for vm in `virsh list --all | tail -n+3 | awk '{ print $2 }' | egrep 'fuel-master|compute|controller'`
42 virsh dumpxml $vm > $vmdir/$vm
45 # Remove all attached ISOs, generalize the rest of the setup
49 sed -i "s/<source file='.*raw'/<source file='disk.raw'/" $vm
57 sed -i '/<uuid/d' $net