feature #2097: Change datastore mad VMFS paths (and comply with the 80 columns limit) (well, almost)

(cherry picked from commit 47bdf93a4c)
This commit is contained in:
Tino Vazquez authored and Ruben S. Montero committed 2013-06-03 23:38:22 +02:00
1 parent 51887fb006
commit be3e12e6a2
4 files changed
+27 -19

No files matched your search

+9 -4
View File
@@ -82,13 +82,18 @@ log "Copying local image $SRC to the image repository"
if [ "$USE_SSH" == "yes" ]; then
if ! is_cdrom; then
ssh_make_path $DST_HOST /vmfs/volumes/$DS_ID/$DST_FOLDER
ssh_exec_and_log $DST_HOST "$VMKFSTOOLS $VI_PARAMS -i /vmfs/volumes/$DS_ID/$SRC_FOLDER/disk.vmdk /vmfs/volumes/$DS_ID/$DST_FOLDER/disk.vmdk" "Error copying /vmfs/volumes/$DS_ID/$SRC_FOLDER/disk.vmdk to /vmfs/volumes/$DS_ID/$DST_FOLDER/disk.vmdk"
ssh_exec_and_log $DST_HOST \
"$VMKFSTOOLS $VI_PARAMS -i $SRC/disk.vmdk $DST/disk.vmdk" \
"Error copying $SRC/disk.vmdk to $DST/disk.vmdk"
else
ssh_exec_and_log $DST_HOST "cp /vmfs/volumes/$DS_ID/$SRC_FOLDER /vmfs/volumes/$DS_ID/$DST_FOLDER" "Error copying /vmfs/volumes/$DS_ID/$SRC_FOLDER to /vmfs/volumes/$DS_ID/$DST_FOLDER in $DST_HOST"
ssh_exec_and_log $DST_HOST \
"cp $SRC $DST" \
"Error copying $SRC $DST in $DST_HOST"
fi
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"
+4 -3
View File
@@ -82,7 +82,6 @@ LIMIT_TRANSFER_BW="${XPATH_ELEMENTS[13]}"
FE_DST=`generate_image_path`
DST_FOLDER=`basename $FE_DST`
DST="/vmfs/volumes/$DS_ID/$DST_FOLDER"
DST_HOST=`get_destination_host $IMAGE_ID`
@@ -148,9 +147,11 @@ fi
# Make the final hop, front-end -> VMFS Datastore
if [ "$USE_SSH" == "yes" ]; then
if ! is_cdrom; then
exec_and_log "$SCP -r $SRC/* $DST_HOST:$DST" "Error copying $SRC to $DST through SCP"
exec_and_log "$SCP -r $SRC/* $DST_HOST:$DST" \
"Error copying $SRC to $DST through SCP"
else
exec_and_log "$SCP $SRC $DST_HOST:$DST" "Error copying $SRC to $DST through SCP"
exec_and_log "$SCP $SRC $DST_HOST:$DST" \
"Error copying $SRC to $DST through SCP"
fi
else
if ! is_cdrom; then
+9 -6
View File
@@ -89,19 +89,22 @@ fi
# ------------ Create the image within the image datastore ------------
log "Making filesystem of ${SIZE}M (with no format) at [$DS_ID]$DST_FOLDER on $DST_HOST"
log "Making raw filesystem of ${SIZE}M at [$DS_ID]$DST_FOLDER on $DST_HOST"
IMAGE_FORMAT=vmdk
VMWARE_DISK_TYPE=`echo $FSTYPE|cut -d'_' -f 2`
if [ "$USE_SSH" == "yes" ]; then
$SSH $DST_HOST $VMKFSTOOLS -U [$DS_ID]$DST_FOLDER/disk.vmdk &> /dev/null
ssh_exec_and_log $DST_HOST "$VMKFSTOOLS -c ${SIZE}M -d ${VMWARE_DISK_TYPE} /vmfs/volumes/$DS_ID/$DST_FOLDER/disk.vmdk" \
"Cannot create [$DS_ID] $DST_FOLDER/disk.vmdk on $DST_HOST"
ssh_exec_and_log $DST_HOST \
"$VMKFSTOOLS -c ${SIZE}M -d ${VMWARE_DISK_TYPE} $DST/disk.vmdk" \
"Cannot create [$DS_ID] $DST_FOLDER/disk.vmdk on $DST_HOST"
else
$VMKFSTOOLS $VI_PARAMS -U [$DS_ID]$DST_FOLDER/disk.vmdk &> /dev/null
exec_and_log "$VMKFSTOOLS $VI_PARAMS -c ${SIZE}M -d ${VMWARE_DISK_TYPE} [$DS_ID]$DST_FOLDER/disk.vmdk" \
"Cannot create $DS_ID]$DST_FOLDER/disk.vmdk on $DST_HOST"
exec_and_log \
"$VMKFSTOOLS $VI_PARAMS -c ${SIZE}M -d ${VMWARE_DISK_TYPE} \
[$DS_ID]$DST_FOLDER/disk.vmdk" \
"Cannot create $DS_ID]$DST_FOLDER/disk.vmdk on $DST_HOST"
fi
echo "/vmfs/volumes/$DS_ID/$DST_FOLDER"
echo "$DST"
+5 -6
View File
@@ -57,8 +57,8 @@ DS_ID="${XPATH_ELEMENTS[1]}"
USE_SSH="${XPATH_ELEMENTS[4]:-$DS_USE_SSH}"
IMAGE_ID="${XPATH_ELEMENTS[2]}"
DST_HOST=`get_destination_host $IMAGE_ID`
DST_FOLDER=`basename $SRC`
DST_HOST=`get_destination_host $IMAGE_ID` # To comply with vmfs_set_up
SRC_FOLDER=`basename $SRC`
# ------------ Set up datastore ------------
@@ -70,14 +70,13 @@ log "Removing $SRC from the image repository"
if [ "$USE_SSH" == "yes" ]; then
if [ -n $DS_ID -a -n $DST_FOLDER ]; then
ssh_exec_and_log $DST_HOST "rm -rf /vmfs/volumes/$DS_ID/$DST_FOLDER" \
"Error deleting $SRC"
ssh_exec_and_log $DST_HOST "rm -rf $SRC" "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_ID]$DST_FOLDER|grep -v "Content Listing"|grep -v "\-\-\-\-\-\-\-\-"|egrep -v "^[[:space:]]*$"`
FILES_TO_ERASE=`vifs $VI_PARAMS --dir [$DS_ID]$SRC_FOLDER|grep -v "Content Listing"|grep -v "\-\-\-\-\-\-\-\-"|egrep -v "^[[:space:]]*$"`
for file in $FILES_TO_ERASE; do
exec_and_log "vifs $VI_PARAMS --force --rm [$DS_ID]$DST_FOLDER/$file" \
exec_and_log "vifs $VI_PARAMS --force --rm [$DS_ID]$SRC_FOLDER/$file" \
"Cannot delete $DST_FOLDER/$file in $DST_HOST"
done
exec_and_log "vifs $VI_PARAMS --force --rm [$DS_ID]$DST_FOLDER" \