From 64b52a0af04a069a99ed445778ce45ca1b18661d Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Sat, 28 Jul 2018 00:11:54 +0200 Subject: [PATCH] list all istance rbd disks and snapshots --- gnt-rbd.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 gnt-rbd.sh diff --git a/gnt-rbd.sh b/gnt-rbd.sh new file mode 100755 index 0000000..ff96693 --- /dev/null +++ b/gnt-rbd.sh @@ -0,0 +1,16 @@ +#!/bin/sh -e + +dir=/dev/shm/instance +test -e $dir || mkdir $dir + +gnt-instance list -o name,disk_template | grep ' rbd$' | cut -d' ' -f1 | while read instance ; do + if [ ! -e $dir/$instance ] ; then + gnt-instance info $instance | tee > $dir/$instance + fi +done + +grep --with-filename logical_id /dev/shm/instance/* | sed "s/^.*\///; s/:.*, '/ /; s/'.*$//;" | tee /dev/shm/instance-rbd | while read instance disk ; do + echo "$instance $disk" + rbd snap ls $disk | sed "s/^/# /" +done + -- 2.20.1