summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominique Martinet <dominique.martinet@cea.fr>2020-07-14 16:43:24 +0200
committerDominique Martinet <dominique.martinet@cea.fr>2020-07-14 17:00:45 +0200
commit36c2129783f7c6e57ca4e1ee21f07852eca86db5 (patch)
tree26a65e9ba2854a6bf34b1be360142a37499bb73c
parent61faf553a3db0727f026f259cbbba05205d7519e (diff)
bootstrap: restore nbd functionality for qcow image
-rwxr-xr-xkvm-wrapper.sh22
1 files changed, 11 insertions, 11 deletions
diff --git a/kvm-wrapper.sh b/kvm-wrapper.sh
index 15dc8da..5f86cd3 100755
--- a/kvm-wrapper.sh
+++ b/kvm-wrapper.sh
@@ -1171,18 +1171,18 @@ function kvm_bootstrap_vm ()
prepare_disks
CLEANUP+=("unprepare_disks")
-# if ! test_blockdev "${KVM_DISK[0]}"
-# then
-# require_exec "$KVM_NBD_BIN"
-# test_file "${KVM_DISK[0]}" || fail_exit "\"${KVM_DISK[0]}\" appears to be neither a blockdev nor a regular file."
-# echo "Attempting to connect the disk image to an nbd device."
-# kvm_nbd_connect "${KVM_DISK[0]}"
-# CLEANUP+=("kvm_nbd_disconnect \"${KVM_DISK[0]}\"")
-# local BOOTSTRAP_DEVICE=$(nbd_img_link "${KVM_DISK[0]}")
-# sleep 1 #needed to give time to the nbd to really connect
-# else
+ if ! test_blockdev "${KVM_DISK[0]}"
+ then
+ require_exec "$KVM_NBD_BIN"
+ test_file "${KVM_DISK[0]}" || fail_exit "\"${KVM_DISK[0]}\" appears to be neither a blockdev nor a regular file."
+ echo "Attempting to connect the disk image to an nbd device."
+ kvm_nbd_connect "${KVM_DISK[0]}"
+ CLEANUP+=("kvm_nbd_disconnect \"${KVM_DISK[0]}\"")
+ local BOOTSTRAP_DEVICE=$(nbd_img_link "${KVM_DISK[0]}")
+ sleep 1 #needed to give time to the nbd to really connect
+ else
local BOOTSTRAP_DEVICE="${KVM_DISK[0]}"
-# fi
+ fi
echo "Starting to bootstrap $VM_NAME as $BOOTSTRAP_DISTRIB on disk $BOOTSTRAP_DEVICE"
bootstrap_fs "$BOOTSTRAP_DEVICE"