File tree Expand file tree Collapse file tree 1 file changed +20
-8
lines changed
Expand file tree Collapse file tree 1 file changed +20
-8
lines changed Original file line number Diff line number Diff line change @@ -100,17 +100,29 @@ if [ `is_disk $DST_PATH` -eq 0 ]; then
100100
101101 ssh_exec_and_log " $DST_HOST " " rm -rf '$DST_PATH '" \
102102 " Error removing target path to prevent overwrite errors"
103-
104- TAR_SSH=$( cat << EOF
105- set -e -o pipefail
106-
107- $TAR -C $SRC_DS_DIR --sparse -cf - $SRC_VM_DIR | $SSH $DST_HOST '$TAR -C $DST_DIR --sparse -xf -'
108- rm -rf $SRC_PATH
103+
104+ if [ " $SRC_HOST " == " $DST_HOST " ]; then
105+ log " Moving on same host only between datastores"
106+
107+ MV_CMD=$( cat << EOF
108+ set -e -o pipefail
109+
110+ mv $SRC_PATH $DST_PATH
111+ EOF
112+ )
113+ ssh_exec_and_log " $SRC_HOST " " $MV_CMD " " Error moving disk directory to new location"
114+ else
115+ TAR_SSH=$( cat << EOF
116+ set -e -o pipefail
117+
118+ $TAR -C $SRC_DS_DIR --sparse -cf - $SRC_VM_DIR | $SSH $DST_HOST '$TAR -C $DST_DIR --sparse -xf -'
119+ rm -rf $SRC_PATH
109120EOF
110121)
111122
112- ssh_exec_and_log " $SRC_HOST " " $TAR_SSH " " Error copying disk directory to target host"
113-
123+ ssh_exec_and_log " $SRC_HOST " " $TAR_SSH " " Error copying disk directory to target host"
124+ fi
125+
114126 exit 0
115127fi
116128
You can’t perform that action at this time.
0 commit comments