From fd4ce9ebeda30f6c40b3f7b02694377772ef9997 Mon Sep 17 00:00:00 2001 From: "Ruben S.Montero" Date: Sat, 24 Dec 2011 00:37:58 +0100 Subject: [PATCH 1/2] feature #1020: Bug in deploy --- src/vmm_mad/remotes/vmware/deploy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vmm_mad/remotes/vmware/deploy b/src/vmm_mad/remotes/vmware/deploy index 290bd60a74..e7024fe1cb 100755 --- a/src/vmm_mad/remotes/vmware/deploy +++ b/src/vmm_mad/remotes/vmware/deploy @@ -33,8 +33,8 @@ dfile = ARGV[0] host = ARGV[1] id = ARGV[3] -vmware_drv = VMwareDriver.new(host, id) +vmware_drv = VMwareDriver.new(host) -puts vmware_drv.deploy(dfile) +puts vmware_drv.deploy(dfile, id) exit 0 From 96918e58b086dcbf8fa16301545f0bd67c9af069 Mon Sep 17 00:00:00 2001 From: "Ruben S.Montero" Date: Sat, 24 Dec 2011 03:51:44 +0100 Subject: [PATCH 2/2] feature #1020: Fix bug in deploywq --- src/tm_mad/vmware/tm_ln.sh | 35 ++++++++++++------------------- src/tm_mad/vmware/tm_mv.sh | 11 ++++++---- src/vmm_mad/remotes/vmware/deploy | 2 +- 3 files changed, 21 insertions(+), 27 deletions(-) diff --git a/src/tm_mad/vmware/tm_ln.sh b/src/tm_mad/vmware/tm_ln.sh index d815341511..cb7f29193a 100755 --- a/src/tm_mad/vmware/tm_ln.sh +++ b/src/tm_mad/vmware/tm_ln.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -xv # ---------------------------------------------------------------------------- # # Copyright 2010-2011, C12G Labs S.L # @@ -26,6 +26,7 @@ else fi . $TMCOMMON +. "`dirname $0`/functions.sh" get_vmdir @@ -34,30 +35,20 @@ DST_PATH=`arg_path $DST` fix_dst_path -DST_DIR=`dirname $DST_PATH` +create_vmdir $DST_PATH -# SRC_PATH needs to be made relative to $ONE_LOCATION/var -VM_FOLDER_NAME=`basename $SRC_PATH` -REPO_NAME="images" -RELATIVE_SRC_PATH="../../$REPO_NAME/$VM_FOLDER_NAME" - -log "Creating directory $DST_PATH" -exec_and_log "rm -rf $DST" -exec_and_log "mkdir -p $DST_PATH" -exec_and_log "chmod a+w $DST_PATH" +# ---------------------------------------------------------------------------- # +# Link all files of the disk directory. Note that link paths needs to be # +# relative in order to be accessible from the vSphere Data Store # +# ---------------------------------------------------------------------------- # +REL_SRC_PATH=`make_relative $SRC_PATH $DST_PATH` log "Link all files in $SRC_PATH to $DST_PATH" -IMAGE_DIR=`dirname $DST_PATH` -cd $IMAGE_DIR - -for file in `find $RELATIVE_SRC_PATH/* -type f`; do - file_name=`basename $file` - exec_and_log "ln -sf ../$file $DST_PATH/$file_name" +for file in `find $SRC_PATH -type f`; do + FNAME=`basename $file` + exec_and_log "ln -sf $REL_SRC_PATH/$FNAME $DST_PATH/$FNAME" done -# Put the symlink mark for tm_mv -exec_and_log "ln -sf $RELATIVE_SRC_PATH $DST_PATH/.disk" - - - +#Mark this disk persistent with a symlink for tm_mv and repo mv +exec_and_log "ln -sf $REL_SRC_PATH $DST_PATH/.disk" diff --git a/src/tm_mad/vmware/tm_mv.sh b/src/tm_mad/vmware/tm_mv.sh index 8a4b27f875..1d149be3bb 100755 --- a/src/tm_mad/vmware/tm_mv.sh +++ b/src/tm_mad/vmware/tm_mv.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash # ---------------------------------------------------------------------------- # # Copyright 2010-2011, C12G Labs S.L # @@ -39,11 +39,14 @@ fix_paths DST_PATH=`fix_dir_slashes "$DST_PATH"` SRC_PATH=`fix_dir_slashes "$SRC_PATH"` +echo $SRC_PATH | grep -q 'disk\.[0-9]\+$' > /dev/null 2>&1 +IS_DISK=$? + if [ "$SRC_PATH" = "$DST_PATH" ]; then log "Will not move, source and destination are equal" -elif [ -f "$SRC_PATH/.disk" ]; then # This link was set in tm_ln.sh -  exec_and_log "mv $SRC_PATH/.disk $DST_PATH" -elif echo $SRC_PATH | grep -q 'disk\.[0-9]\+$'; then +elif [ -L "$SRC_PATH/.disk" ]; then # This link was set in tm_ln.sh + exec_and_log "mv $SRC_PATH/.disk $DST_PATH" +elif [ IS_DISK -eq 0 ]; then    log "Moving $SRC_PATH"    exec_and_log "mv $SRC_PATH $DST_PATH" elif [ -d $SRC_PATH ]; then diff --git a/src/vmm_mad/remotes/vmware/deploy b/src/vmm_mad/remotes/vmware/deploy index e7024fe1cb..48cbaedd53 100755 --- a/src/vmm_mad/remotes/vmware/deploy +++ b/src/vmm_mad/remotes/vmware/deploy @@ -31,7 +31,7 @@ require 'vmwarelib' dfile = ARGV[0] host = ARGV[1] -id = ARGV[3] +id = ARGV[2] vmware_drv = VMwareDriver.new(host)