blob: c739514be2ad02a127e13bc5cf8ec7fa5f9aab61 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
#!/bin/bash
SCDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "$SCDIR/ctrl-c"||exit 1
ODETFIL="$SCDIR/../kvm_overview"
ODETDIR="$SCDIR/../kvm-details"
echo -n "Fetching KVM config"
(
echo -n ".";>"$ODETFIL";[ "$?" -ne 0 ]&&echo "failed."&&exit 1||true
echo -n ".";virsh list --all --title>>"$ODETFIL" 2>/dev/null;[ "$?" -ne 0 ]&&exit 1||true
echo -n ".";echo "" >> "$ODETFIL";virsh net-list --all>>"$ODETFIL" 2>/dev/null;[ "$?" -ne 0 ]&&exit 1||true
echo -n ".";echo "" >> "$ODETFIL";virsh pool-list --all --details>>"$ODETFIL" 2>/dev/null;[ "$?" -ne 0 ]&&exit 1||true
echo -n ".";for i in $(virsh list --all --name);do virsh dumpxml "$i">"$ODETDIR"/domain-"$i".xml||break;done;[ "$?" -ne 0 ]&&exit 1||true
echo -n ".";for i in $(virsh net-list --all --name);do virsh net-dumpxml "$i">"$ODETDIR"/net-"$i".xml||break;done;[ "$?" -ne 0 ]&&exit 1||true
echo -n ".";for i in $(virsh pool-list --all --name);do virsh pool-dumpxml "$i">"$ODETDIR"/pool-"$i".xml||break;done;[ "$?" -ne 0 ]&&exit 1||true
)
[ "$?" -ne 0 ]&&echo "failed."||echo "done."
|