mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-22 18:50:08 +03:00
feature #1020: Fix bug in deploywq
This commit is contained in:
parent
fd4ce9ebed
commit
96918e58b0
@ -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"
|
||||
|
@ -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
|
||||
|
@ -31,7 +31,7 @@ require 'vmwarelib'
|
||||
|
||||
dfile = ARGV[0]
|
||||
host = ARGV[1]
|
||||
id = ARGV[3]
|
||||
id = ARGV[2]
|
||||
|
||||
vmware_drv = VMwareDriver.new(host)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user