From 1e21cf01b1cb273743ac1e56e5969e3feab3f369 Mon Sep 17 00:00:00 2001 From: Alexander Evseev <11456446+EBCEEB@users.noreply.github.com> Date: Fri, 30 Jun 2023 17:30:29 +0300 Subject: [PATCH] Allow migration ov LVM-backed VMs Update fs_lvm_ssh/mv to allow VMs migration between hosts. --- src/tm_mad/fs_lvm_ssh/mv | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/tm_mad/fs_lvm_ssh/mv b/src/tm_mad/fs_lvm_ssh/mv index 506edceda3e..9dd4f7ccd6b 100755 --- a/src/tm_mad/fs_lvm_ssh/mv +++ b/src/tm_mad/fs_lvm_ssh/mv @@ -110,19 +110,23 @@ EOF fi # copy volume between datastores - if [ "${SRC_PATH}" != "${DST_PATH}" ]; then + if [ "${SRC_PATH}" != "${DST_PATH}" ] || [ "${SRC_HOST}" != "${DST_HOST}" ]; then # create new volume CREATE_CMD=$(cat < /dev/null\\" | ${DD} if=- of=${DST_DEV}" + else + COPY_CMD="${DD} if=${SRC_DEV} of=${DST_DEV} bs=${DD_BLOCK_SIZE:-64k}" + fi + LOCK="tm-fs_lvm-${SRC_DS_SYS_ID}.lock" + exclusive "${LOCK}" 7200 ssh_exec_and_log "${DST_HOST}" "${COPY_CMD}" \ "Error copying ${SRC} to ${DST}" # delete old volume and update device symlinks