<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">2013/10/11 Valerio Pachera <span dir="ltr"><<a href="mailto:sirio81@gmail.com" target="_blank">sirio81@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Hi, I think it would be nice to have the option<br>
<br>
-A --auto<br>
<br>
or<br>
<br>
-A --all<br>
<br>
that will automatically create a snapshot of all vdi before saving the<br>
cluster snapshot.<br></blockquote><div><br></div><div>Waiting this future I created two bash scripts that other users may find useful.<br></div><div>They are very simple to customize.<br><br>-----------------<br>vdi_snap_all.sh<br>
<br>#!/bin/bash<br><br>vdi_list='/tmp/vdis.list'<br>tag='widesnap'<br><br>error () {<br> echo "Error: $1"; exit 2<br>}<br><br>dog vdi list > $vdi_list || error "Impossible to get vdi list."<br>
<br>vdis=$(grep -v ^s $vdi_list | tail -n +2 | grep ^' ' | awk '{print $1}')<br>vdis_clone=$(grep -v ^s $vdi_list | tail -n +2 | grep ^'c ' | awk '{print $2}')<br>vdis="$vdis $vdi_clones"<br>
<br>for vdi in $vdis<br>do<br> echo -n "Creating snapshot of $vdi..."<br> dog vdi snapshot -s $tag $vdi && echo 'done' || echo 'Failed'<br>done<br><br>rm $vdi_list<br><br>---------------- <br>
</div><div>vdi_snap_remove.sh<br></div><div><br></div><div>#!/bin/bash<br></div><div>vdi_list='/tmp/vdis.list'<br>tag='widesnap'<br><br>error () {<br> echo "Error: $1"; exit 2<br>}<br><br>dog vdi list > $vdi_list || error "Impossible to get vdi list."<br>
<br>vdis=$(grep -w "$tag" $vdi_list | awk '{print $2}')<br>[ -z "vdis" ] && error "No vdi with tag $tag found"<br><br>for vdi in $vdis<br>do<br> echo -n "Removing snapshot $tag of $vdi..."<br>
dog vdi delete -s $tag $vdi && echo 'done' || echo 'Failed'<br>done<br><br>rm $vdi_list<br></div></div></div></div>