1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-23 22:50:09 +03:00

M #3460: Create file to detect same dir (#129)

inode number might conflict
This commit is contained in:
Jan Orel 2020-07-29 17:01:25 +02:00 committed by GitHub
parent c95d03cb9f
commit 37e92f4f63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -60,10 +60,9 @@ if [ `is_disk $DST_PATH` -eq 1 ]; then
exit 0
fi
DST_INODE=$(timeout 10 ssh "$DST_HOST" "ls -d -i \"$DST_DIR\" | awk '{print \$1}'")
SRC_INODE=$(timeout 10 ssh "$SRC_HOST" "ls -d -i \"$SRC_DIR\" | awk '{print \$1}'")
if [ -n "$SRC_INODE" ] && [ -n "$DST_INODE" ] && [ "$SRC_INODE" = "$DST_INODE" ]; then
RANDOM_FILE=$(ssh "$DST_HOST" "mktemp -p \"$DST_DIR\"")
trap "ssh $DST_HOST \"rm -f $RANDOM_FILE\"" EXIT TERM INT HUP
if ssh "$SRC_HOST" "test -f $RANDOM_FILE"; then
log "Not moving $SRC to $DST, they are the same path"
exit 0
fi