Excellent, thanks for the update... <br><br><div class="gmail_quote">On Fri Jan 16 2015 at 3:10:21 PM Fabian Zimmermann <<a href="mailto:dev.faz@gmail.com">dev.faz@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
answering myself:<br>
<br>
Am 16.01.15 um 13:59 schrieb Fabian Zimmermann:<br>
> Hi,<br>
><br>
> Am 22.10.14 um 10:42 schrieb Ruben S. Montero:<br>
>> They should be supported for RBD 2 images, you may want to take a look to<br>
>> the actual cloning process in tm/ceph/clone<br>
> looks like /var/lib/one/remotes/tm/ceph/<u></u>cpds is used in case of a hot<br>
> hdd-snapshot.<br>
yes, because ceph would block the deletion of the source-image until the<br>
new image is flatten and all snapshots are removed.<br>
> Should one use this script to create a hot snapshot?<br>
><br>
> If yes, is it a good idea to reuse the<br>
><br>
> if RBD_FORMAT=2<br>
> then<br>
>    clone<br>
> else<br>
>   copy<br>
><br>
> system of tm/ceph/clone in tm/ceph/cpds or may this lead to other problems?<br>
Already asked at ceph-mailinglist if "rbd cp" is doing an internal<br>
snapshot to protect consistency of data. If not a "snap, protect,<br>
flatten, unprotect, rm" would be done with the following patch:<br>
<br>
--<br>
--- cpds.orig    2015-01-16 14:09:10.116016425 +0100<br>
+++ cpds    2015-01-16 15:00:26.666220420 +0100<br>
@@ -1,5 +1,7 @@<br>
 #!/bin/bash<br>
<br>
+echo $* > /tmp/$$<br>
+<br>
 #<br>
------------------------------<u></u>------------------------------<u></u>-------------- #<br>
 # Copyright 2002-2014, OpenNebula Project (OpenNebula.org), C12G<br>
Labs        #<br>
 #<br>
#<br>
@@ -80,8 +82,27 @@<br>
     RBD="$RBD --id ${CEPH_USER}"<br>
 fi<br>
<br>
+RBD_SNAP="cpds-${VM_ID}-${<u></u>DISK_ID}-$( date +%s )"<br>
+<br>
+CP_CMD=$(<br>
+cat <<EOF<br>
+set -e<br>
+<br>
+RBD_FORMAT=\$($RBD info $RBD_DST | sed -n 's/.*format: // p')<br>
+if [ "\$RBD_FORMAT" = "2" ]; then<br>
+    $RBD snap create "$RBD_DST@$RBD_SNAP"<br>
+    $RBD snap protect "$RBD_DST@$RBD_SNAP"<br>
+    $RBD clone "$RBD_DST@$RBD_SNAP" $DST<br>
+    $RBD flatten $DST<br>
+    $RBD snap unprotect "$RBD_DST@$RBD_SNAP"<br>
+    $RBD snap rm "$RBD_DST@$RBD_SNAP"<br>
+else<br>
+    $RBD copy $RBD_DST $DST<br>
+fi<br>
+EOF<br>
+)<br>
<br>
-ssh_exec_and_log "$SRC_HOST" "$RBD copy $RBD_DST $DST" \<br>
+ssh_exec_and_log "$SRC_HOST" "$CP_CMD" \<br>
                  "Error cloning $RBD_DST to $DST in $SRC_HOST"<br>
<br>
 exit 0<br>
--<br>
<br>
I will create a feature-request if "rbd cp" isn't using an internal<br>
snapshot.<br>
<br>
Fabian<br>
<br>
</blockquote></div>