[one-users] Corrections for mkimage on vmware

Emmanuel Mathot emmanuel.mathot at terradue.com
Sun Jul 15 22:58:31 PDT 2012


Hello,

Before posting a bug on dev.opennebula.org, I submit you some corrections I made to the transfer manager scripts to have the mkimage script working on vmware.
Let me know.

--- /usr/lib/one/sh/scripts_common.sh   2012-07-16 07:58:15.873452099 +0200
+++ /usr/lib/one/sh/scripts_common.sh.old       2012-07-16 07:56:39.548454580 +0200
@@ -251,12 +251,11 @@
             return 0
             ;;
         vmdk_*)
-            VMWARE_DISK_TYPE=`echo $FSTYPE|cut -d'_' -f 2`
-            echo "if which sudo > /dev/null; then \
-                       SUDO_CMD="sudo " \
-                 fi \
-                  $SUDO_CMD $VMKFSTOOLS -U $DST/disk.vmdk; \
-                  $SUDO_CMD $VMKFSTOOLS -c ${SIZE}M -d ${VMWARE_DISK_TYPE} $DST_PATH/disk.vmdk"
+            VMWARE_DISK_TYPE=`echo $FSTYPE|cut -d'_' -f 1`
+            echo "WHICH_SUDO=\$(which sudo) ; \
+                  [ ! -z \"\$WHICH_SUDO\" -a -f \"\$WHICH_SUDO\" ] && SUDO=\"sudo\" ; \
+                  $SUDO $VMKFSTOOLS -U $DST/disk.vmdk; \
+                  $SUDO $VMKFSTOOLS -c ${SIZE}M -d ${VMWARE_DISK_TYPE} $DST_PATH/disk.vmdk"
             return 0
             ;;
         *)


--- /var/lib/one/remotes/tm/ssh/mkimage 2012-07-16 07:48:36.285451366 +0200
+++ /var/lib/one/remotes/tm/ssh/mkimage.old     2012-07-16 07:52:26.531451982 +0200
@@ -55,8 +55,6 @@
 
 if ! echo "$FSTYPE"|grep -q ^vmdk; then
   CREATE_IMAGE="$DD if=/dev/zero of=$DST_PATH bs=1 count=1 seek=${SIZE}M"
-else
-  CREATE_IMAGE="mkdir -p $DST_PATH"
 fi
  
 MKSCRIPT=$(cat <<EOF

Cheers,

Emmanuel Mathot
www.terradue.com


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opennebula.org/pipermail/users-opennebula.org/attachments/20120716/769b1f79/attachment.htm>


More information about the Users mailing list