mirror of
https://github.com/OpenNebula/one.git
synced 2025-01-22 22:03:39 +03:00
Bug #3097: remove target symlink before creating it in the LN and CLONE actions
This commit is contained in:
parent
fc0342533f
commit
4ad798b172
@ -55,7 +55,7 @@ ssh_make_path $DST_HOST $DST_DIR
|
||||
log "Linking $SRC_PATH in $DST"
|
||||
|
||||
ssh_exec_and_log $DST_HOST \
|
||||
"cd $DST_DIR; rm $DST_PATH ; ln -s $SRC_PATH $DST_PATH" \
|
||||
"cd $DST_DIR; rm -f $DST_PATH ; ln -s $SRC_PATH $DST_PATH" \
|
||||
"Error linking $SRC to $DST"
|
||||
|
||||
exit 0
|
||||
|
@ -78,6 +78,7 @@ CLONE_CMD=$(cat <<EOF
|
||||
|
||||
$SUDO $LVCREATE -L${SIZE}B -n $LV_NAME $VG_NAME
|
||||
$SUDO $DD if="$SRC_PATH" of="$DEV" bs=64k
|
||||
rm -f "$DST_PATH"
|
||||
ln -s "$DEV" "$DST_PATH"
|
||||
EOF
|
||||
)
|
||||
|
@ -74,6 +74,7 @@ CLONE_CMD=$(cat <<EOF
|
||||
| tr -d ' ')
|
||||
$SUDO $LVCREATE -L\${SIZE}M -n $LV_CLONE $VG_NAME
|
||||
$SUDO $DD if=$TARGET_DEV of=$LV_CLONE_DEV bs=64k
|
||||
rm -f "$DST_PATH"
|
||||
ln -s "$LV_CLONE_DEV" "$DST_PATH"
|
||||
EOF
|
||||
)
|
||||
|
@ -52,7 +52,8 @@ TARGET_DEV="/dev/$VG_NAME/$LV_NAME"
|
||||
LINK_CMD=$(cat <<EOF
|
||||
set -e
|
||||
mkdir -p $DST_DIR
|
||||
ln -sf "$TARGET_DEV" "$DST_PATH"
|
||||
rm -f "$DST_PATH"
|
||||
ln -s "$TARGET_DEV" "$DST_PATH"
|
||||
EOF
|
||||
)
|
||||
|
||||
|
@ -68,7 +68,7 @@ http://*)
|
||||
*)
|
||||
log "Cloning $SRC_PATH in $DST"
|
||||
|
||||
CLONE_CMD="cd $DST_DIR; $QEMU_IMG create -b $SRC_PATH -f qcow2 $DST_PATH"
|
||||
CLONE_CMD="cd $DST_DIR; rm -f $DST_PATH; $QEMU_IMG create -b $SRC_PATH -f qcow2 $DST_PATH"
|
||||
ssh_exec_and_log "$DST_HOST" "$CLONE_CMD" "Error copying $SRC to $DST"
|
||||
;;
|
||||
esac
|
||||
|
@ -64,7 +64,7 @@ ssh_make_path $DST_HOST $DST_DIR
|
||||
log "Linking $SRC_PATH in $DST"
|
||||
|
||||
ssh_exec_and_log $DST_HOST \
|
||||
"cd $DST_DIR; rm $DST_PATH ; ln -s $SRC_PATH $DST_PATH" \
|
||||
"cd $DST_DIR; rm -f $DST_PATH ; ln -s $SRC_PATH $DST_PATH" \
|
||||
"Error linking $SRC to $DST"
|
||||
|
||||
exit 0
|
||||
|
@ -87,6 +87,8 @@ else
|
||||
rm -f $DST_PATH
|
||||
|
||||
cp $SRC_PATH $DST_PATH
|
||||
|
||||
rm -f $DST_PATH.iso
|
||||
ln -s $DST_PATH $DST_PATH.iso
|
||||
fi
|
||||
EOF
|
||||
|
@ -84,6 +84,7 @@ if [ ! -d $DST_DIR ]; then
|
||||
mkdir -p $DST_DIR
|
||||
fi
|
||||
|
||||
rm -f $DST_PATH.iso
|
||||
ln -s $SRC_PATH $DST_PATH.iso
|
||||
EOF
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user