[one-dev] Why linked and not cloned?

Jaime Melis jmelis at opennebula.org
Wed Jun 4 02:06:56 PDT 2014


Hi Fabian,

I think you are right, I have created an issue to review this at some point:
http://dev.opennebula.org/issues/2960

A possible solution would be to extract the disk type and test against it,
like this:

-------8<---------------
diff --git a/src/tm_mad/ceph/delete b/src/tm_mad/ceph/delete
index f8cbf83..5051f93 100755
--- a/src/tm_mad/ceph/delete
+++ b/src/tm_mad/ceph/delete
@@ -68,15 +68,20 @@ while IFS= read -r -d '' element; do
 done < <(onevm show -x $VM_ID| $XPATH \
                     /VM/TEMPLATE/DISK[DISK_ID=$DISK_ID]/SOURCE \
                     /VM/TEMPLATE/DISK[DISK_ID=$DISK_ID]/PERSISTENT \
-                    /VM/TEMPLATE/DISK[DISK_ID=$DISK_ID]/RBD_FORMAT)
+                    /VM/TEMPLATE/DISK[DISK_ID=$DISK_ID]/RBD_FORMAT \
+                    /VM/TEMPLATE/DISK[DISK_ID=$DISK_ID]/TYPE)

 SRC="${XPATH_ELEMENTS[j++]}"
 PERSISTENT="${XPATH_ELEMENTS[j++]}"
 RBD_FORMAT="${XPATH_ELEMENTS[j++]}"
+TYPE="${XPATH_ELEMENTS[j++]}"

 # Exit if persistent
 [ -n "$PERSISTENT" ] && exit 0

+# Exit if CDROM
+[ "$TYPE" = "CDROM" ] && exit 0
+
 # non persistent, so the name will be
"<pool>/one-<imageid>-<vmid>-<diskid>"
 RBD_SRC="${SRC}-${VM_ID}-${DISK_ID}"
 RBD_SNAP="${VM_ID}-${DISK_ID}"
------->8---------------

What I'm not sure about right now is if CDROM disks in the Ceph datastore
are cloned or linked, but I think you're right and this is a bug.

Cheers,
Jaime
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opennebula.org/pipermail/dev-opennebula.org/attachments/20140604/dd1278c4/attachment.htm>


More information about the Dev mailing list