mirror of
https://github.com/OpenNebula/one.git
synced 2025-01-31 01:47:11 +03:00
Revert "B #5170: add a lock to lvm actions in fs_lvm"
This reverts commit 8ea71b1a46d63a5e0c9c71e77aee99cba37f0dd3. flock can not be used with bash functions. Create a new exec_and_lock function with lock.
This commit is contained in:
parent
c976f87c92
commit
a8cd7ca032
@ -90,24 +90,11 @@ LV_NAME="lv-one-$VM_ID-$DISK_ID"
|
||||
VG_NAME="vg-one-$DS_SYS_ID"
|
||||
DEV="/dev/${VG_NAME}/${LV_NAME}"
|
||||
|
||||
# Execute lvcreate with a lock in the frontend
|
||||
mkdir -p $DST_DS_PATH
|
||||
|
||||
CREATE_CMD=$(cat <<EOF
|
||||
$SUDO $SYNC
|
||||
$SUDO $LVSCAN
|
||||
|
||||
$SUDO $LVCREATE --wipesignatures n -L${SIZE}M -n $LV_NAME $VG_NAME
|
||||
EOF
|
||||
)
|
||||
|
||||
LOCK_FILE="$DST_DS_PATH/lock"
|
||||
flock -w 120 $LOCK_FILE ssh_exec_and_log "$DST_HOST" "$CREATE_CMD" \
|
||||
"Error creating LV named $LV_NAME"
|
||||
|
||||
CLONE_CMD=$(cat <<EOF
|
||||
set -e -o pipefail
|
||||
mkdir -p $DST_DIR
|
||||
|
||||
$SUDO $LVCREATE --wipesignatures n -L${SIZE}M -n $LV_NAME $VG_NAME
|
||||
$QEMU_IMG convert -O raw "$SRC_PATH" "$DEV"
|
||||
rm -f "$DST_PATH"
|
||||
ln -s "$DEV" "$DST_PATH"
|
||||
|
@ -60,7 +60,5 @@ DELETE_CMD=$(cat <<EOF
|
||||
EOF
|
||||
)
|
||||
|
||||
LOCK_FILE="$DST_DS_PATH/lock"
|
||||
flock -w 120 $LOCK_FILE ssh_exec_and_log "$DST_HOST" "$DELETE_CMD" \
|
||||
"Error deleting $DST_PATH"
|
||||
ssh_exec_and_log "$DST_HOST" "$DELETE_CMD" "Error deleting $DST_PATH"
|
||||
|
||||
|
@ -54,10 +54,6 @@ DEV="/dev/${VG_NAME}/${LV_NAME}"
|
||||
|
||||
DUMP_CMD=$(cat <<EOF
|
||||
$DD if=$DEV of=$DST_PATH bs=64k
|
||||
EOF
|
||||
)
|
||||
|
||||
DELETE_CMD=$(cat <<EOF
|
||||
$SUDO $LVREMOVE -f $DEV
|
||||
EOF
|
||||
)
|
||||
@ -70,8 +66,4 @@ log "Dumping $SRC to $DST"
|
||||
ssh_exec_and_log "$SRC_HOST" "$DUMP_CMD" \
|
||||
"Error dumping $SRC to $DST"
|
||||
|
||||
LOCK_FILE="$DST_DS_PATH/lock"
|
||||
flock -w 120 $LOCK_FILE ssh_exec_and_log "$SRC_HOST" "$REMOVE_CMD" \
|
||||
"Error deleting LV $LV_NAME"
|
||||
|
||||
exit 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user