[sheepdog-users] Proposal to add option for cluster snapshot

Valerio Pachera sirio81 at gmail.com
Wed Nov 27 11:38:39 CET 2013


2013/10/11 Valerio Pachera <sirio81 at gmail.com>

> Hi, I think it would be nice to have the option
>
> -A --auto
>
> or
>
> -A --all
>
> that will automatically create a snapshot of all vdi before saving the
> cluster snapshot.
>

Waiting this future I created two bash scripts that other users may find
useful.
They are very simple to customize.

-----------------
vdi_snap_all.sh

#!/bin/bash

vdi_list='/tmp/vdis.list'
tag='widesnap'

error () {
    echo "Error: $1"; exit 2
}

dog vdi list > $vdi_list || error "Impossible to get vdi list."

vdis=$(grep -v ^s $vdi_list  | tail -n +2 | grep ^'  ' | awk '{print $1}')
vdis_clone=$(grep -v ^s $vdi_list  | tail -n +2 | grep ^'c ' | awk '{print
$2}')
vdis="$vdis $vdi_clones"

for vdi in $vdis
do
    echo -n "Creating snapshot of $vdi..."
    dog vdi snapshot -s $tag $vdi && echo 'done' || echo 'Failed'
done

rm $vdi_list

----------------
vdi_snap_remove.sh

#!/bin/bash
vdi_list='/tmp/vdis.list'
tag='widesnap'

error () {
    echo "Error: $1"; exit 2
}

dog vdi list > $vdi_list || error "Impossible to get vdi list."

vdis=$(grep -w "$tag" $vdi_list | awk '{print $2}')
[ -z "vdis" ] && error "No vdi with tag $tag found"

for vdi in $vdis
do
    echo -n "Removing snapshot $tag of $vdi..."
    dog vdi delete -s $tag $vdi && echo 'done' || echo 'Failed'
done

rm $vdi_list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wpkg.org/pipermail/sheepdog-users/attachments/20131127/a59515cc/attachment-0004.html>


More information about the sheepdog-users mailing list