added "install it" target
[gnt-info] / gnt-rbd.sh
1 #!/bin/sh -e
2
3 dir=/dev/shm/instance
4 test -e $dir || mkdir $dir
5
6 gnt-instance list -o name,disk_template | grep ' rbd$' | cut -d' ' -f1 | while read instance ; do
7         if [ ! -e $dir/$instance ] ; then
8                 gnt-instance info $instance | tee > $dir/$instance
9         fi
10 done
11
12 grep --with-filename 'logical_id.*rbd' /dev/shm/instance/* | sed "s/^.*\///; s/:.*, '/ /; s/'.*$//;" | tee /dev/shm/instance-rbd | while read instance disk ; do
13         echo "$instance $disk"
14         rbd snap ls $disk | grep -v SNAPID | awk -v instance=$instance -v disk=$disk '{ print instance,disk"@"$2,"#"$1,$3,$4 }'
15 done
16