video 7cda803e-f877-4001-b9ce-9d460e3f85b8.rbd.disk0
video f1991f16-f59c-4e9d-adae-79cbfe034878.rbd.disk1
+Then there is script to start snapshot backup from rbd instance to lib15:
+
+root@r1u28:/srv/gnt-info# ./rbd-snap-backup.sh odin.ffzg.hr 1
+
+gnt-lv-snap-rsync.sh will call this script if it can't find any lvm volumes
+for that disk
+
+If backup fails for some reason, it might leave mounted filesystem. You have
+to umount that manually. After that, there is cleanup script to remove left-overs
+of @backup snapshots from ceph:
+
+root@r1u28:/srv/gnt-info# ./rbd-remove-snap.sh
vg=`gnt-cluster info | grep 'lvm volume group:' | cut -d: -f2 | tr -d ' '`
+found_lvm=0
+
ssh $node lvs -o name,tags | grep $instance | tee /dev/shm/$instace.$node.lvs | grep disk${disk}_data | while read lv origin ; do
+ found_lvm=1
+
disk_nr=`echo $lv | cut -d. -f2 | tr -d a-z_`
echo "# $lv | $origin | $disk_nr"
rsync_args=""
- if rsync lib15::$backup/$instance/rsync.args /dev/shm/$instance-rsync.args ; then
+ if rsync lib15::$backup/$instance/rsync.args /dev/shm/$instance-rsync.args 2>/dev/null; then
rsync_args="`cat /dev/shm/$instance-rsync.args`"
fi
ssh -i /root/.ssh/id_dsa-zfs lib15 lib15/$backup/$instance/$disk_nr
done
-
+if [ $found_lvm = 0 ] ; then
+ export backup
+ /srv/gnt-info/rbd-snap-backup.sh $instance $disk
+fi
#!/bin/sh -xe
+test -z "$1" -o -z "$2" && echo "Usage: $0 instance disk" && exit 1
+
instance=$1
disk=$2
-
-test -z "$1" -o -z "$2" && echo "Usage: $0 instance disk" && exit 1
+test -z "$backup" && backup="backup"
rbd_image=`gnt-instance info --static $instance | grep logical_id: | cut -d\' -f4 | grep "\.rbd\.disk$disk\$"`
test ! -z "$offset" && offset=",offset=$offset"
mount $rbd_dev /dev/shm/$rbd_image.snap -o noatime$offset
-# execute something on mounted filesystem
-read -p "wait for key" key
+
+# XXX do rsync back to lib15
+
+rsync_args=""
+if rsync lib15::$backup/$instance/rsync.args /dev/shm/$instance-rsync.args 2>/dev/null ; then
+ rsync_args="`cat /dev/shm/$instance-rsync.args`"
+fi
+
+rsync -ravHzXA --inplace --numeric-ids --delete $rsync_args \
+ /dev/shm/$rbd_image.snap/ lib15::$backup/$instance/$disk/ \
+&& ssh -i /root/.ssh/id_dsa-zfs lib15 lib15/$backup/$instance/$disk
+
+# XXX backup OK
+
umount /dev/shm/$rbd_image.snap