1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

feature #1437: Change var names for coherence

This commit is contained in:
Tino Vazquez 2012-09-13 13:12:01 +02:00
parent 1624deaf5f
commit 95596bb25f
4 changed files with 23 additions and 15 deletions

View File

@ -78,7 +78,8 @@ log "Copying local image $SRC to the image repository"
if [ "$SSH" == "yes" ]; then
ssh_exec_and_log "$VMKFSTOOLS $VI_PARAMS $SRC $DST" "Error copying $SRC to $DST"
else
exec_and_log "vifs $VI_PARAMS --copy [$DS_ID]$SRC_FOLDER [$DS_ID]$DST_FOLDER" "Error copying $SRC to $DST"
exec_and_log "vifs $VI_PARAMS --copy [$DS_ID]$SRC_FOLDER [$DS_ID]$DST_FOLDER" \
"Error copying $SRC to $DST"
fi
echo "$DST"

View File

@ -86,7 +86,8 @@ fi
if [ "$SSH" == "yes" ]; then
ssh_make_path $DST_HOST $DST
else
exec_and_log "vifs $VI_PARAMS --mkdir [$DS_ID]$DST_FOLDER" "Cannot create $DST in $DST_HOST"
exec_and_log "vifs $VI_PARAMS --mkdir [$DS_ID]$DST_FOLDER" \
"Cannot create $DST in $DST_HOST"
fi
# Prepare for a possible download in the front-end
@ -135,8 +136,8 @@ esac
if [ ! -f $SRC/disk.vmdk ]; then
BASE_DISK_FILE=`ls $SRC | grep -v '\-\(flat\|delta\|s[0-9]*\)\.vmdk$'`
exec_and_log "mv -f $FE_DST/$BASE_DISK_FILE $DST/disk.vmdk" \
"Error renaming disk file $BASE_DISK_FILE to disk.vmdk"
exec_and_log "mv -f $SRC/$BASE_DISK_FILE $SRC/disk.vmdk" \
"Error renaming disk file $SRC/$BASE_DISK_FILE to $SRC/disk.vmdk"
fi
# Make the final hop, front-end -> VMFS Datastore
@ -146,7 +147,8 @@ else
cd $SRC
for file in $(find . -type f); do
FNAME=$(basename $file)
exec_and_log "vifs $VI_PARAMS -p $file [$DS_ID]$DST_FOLDER/$FNAME" "Cannot upload $file to $DST/$FNAME on $DST_HOST"
exec_and_log "vifs $VI_PARAMS -p $file [$DS_ID]$DST_FOLDER/$FNAME" \
"Cannot upload $file to $DST/$FNAME on $DST_HOST"
done
fi

View File

@ -68,7 +68,7 @@ set_up_datastore "$BASE_PATH" "$RESTRICTED_DIRS" "$SAFE_DIRS" "$UMASK"
DST=`generate_image_path`
DST_DIR=`dirname $DST`
DST_FOLDER_NAME=`basename $DST`
DST_FOLDER=`basename $DST`
DST_HOST=`get_destination_host $(dirname $0)`
if [ "$SSH" != "yes" ]; then
@ -94,12 +94,14 @@ VMWARE_DISK_TYPE=`echo $FSTYPE|cut -d'_' -f 2`
if [ "$SSH" == "yes" ]; then
ssh_exec_and_log $DST_HOST "mkdir -p $DST" "Could not create disk directory $DST"
ssh_exec_and_log $DST_HOST "$VMKFSTOOLS -U $DST/disk.vmdk"
ssh_exec_and_log $DST_HOST "$VMKFSTOOLS -c ${SIZE}M -d ${VMWARE_DISK_TYPE} $DST/disk.vmdk" "Cannot create $DST/disk.vmdk on $DST_HOST"
ssh_exec_and_log $DST_HOST "$VMKFSTOOLS -c ${SIZE}M -d ${VMWARE_DISK_TYPE} $DST/disk.vmdk" \
"Cannot create $DST/disk.vmdk on $DST_HOST"
else
exec_and_log 'vifs $VI_PARAMS --mkdir [$IMAGE_DS_ID]$DST_FOLDER_NAME' "Cannot create [$IMAGE_DS_ID] $DST_FOLDER_NAME on $DST_HOST"
exec_and_log "$VMKFSTOOLS $VI_PARAMS -U $DST_PATH/disk.vmdk"
exec_and_log "$VMKFSTOOLS $VI_PARAMS -c ${SIZE}M -d ${VMWARE_DISK_TYPE} $DST/disk.vmdk" "Cannot create $DST/disk.vmdk on $DST_HOST"
exec_and_log "vifs $VI_PARAMS --mkdir [$IMAGE_DS_ID]$DST_FOLDER" \
"Cannot create [$IMAGE_DS_ID] $DST_FOLDER on $DST_HOST"
exec_and_log "$VMKFSTOOLS $VI_PARAMS -c ${SIZE}M -d ${VMWARE_DISK_TYPE} [$IMAGE_DS_ID]$DST_FOLDER/disk.vmdk" \
"Cannot create $IMAGE_DS_ID]$DST_FOLDER/disk.vmdk on $DST_HOST"
fi
echo "$DST"

View File

@ -55,7 +55,7 @@ SRC="${XPATH_ELEMENTS[0]}"
DS_NAME="${XPATH_ELEMENTS[1]}"
DST_HOST=`get_destination_host $(dirname $0)`
FOLDER_TO_ERASE=`dirname SRC`
DST_FOLDER=`basename $SRC`
if [ "$SSH" != "yes" ]; then
USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"')`
@ -68,16 +68,19 @@ fi
log "Removing $SRC from the image repository"
if [ "$SSH" == "yes" ]; then
if [ -n $DS_NAME -a -n $FOLDER_TO_ERASE -a -d /vmfs/volumes/$DS_NAME/$FOLDER_TO_ERASE ]; then
ssh_exec_and_log $DST_HOST "rm -rf /vmfs/volumes/$DS_NAME/$FOLDER_TO_ERASE" "Error deleting $SRC"
if [ -n $DS_NAME -a -n $DST_FOLDER ]; then
ssh_exec_and_log $DST_HOST "rm -rf /vmfs/volumes/$DS_NAME/$DST_FOLDER" \
"Error deleting $SRC"
fi
else
# We have to erase the contents of the folder one by one
FILES_TO_ERASE=`vifs $VI_PARAMS --dir [$DS_NAME]$FOLDER_TO_ERASE|grep -v "Content Listing"|grep -v "\-\-\-\-\-\-\-\-"|egrep -v "^[[:space:]]*$"`
for file in $FILES_TO_ERASE; do
exec_and_log "vifs $VI_PARAMS --rm [$DS_NAME]$FOLDER_TO_ERASE/$file" "Cannot delete $FOLDER_TO_ERASE/$file in $DST_HOST"
exec_and_log "vifs $VI_PARAMS --force --rm [$DS_NAME]$DST_FOLDER/$file"\
"Cannot delete $DST_FOLDER/$file in $DST_HOST"
done
exec_and_log "vifs $VI_PARAMS --rm [$DS_NAME]$FOLDER_TO_ERASE" "Cannot delete $FOLDER_TO_ERASE in $DST_HOST"
exec_and_log "vifs $VI_PARAMS --force --rm [$DS_NAME]$DST_FOLDER" \
"Cannot delete $DST_FOLDER in $DST_HOST"
fi
exit 0