From d90fa6499cce3a7516a8742804e6080bc75bf866 Mon Sep 17 00:00:00 2001 From: Mateusz Kwiatkowski Date: Wed, 5 Dec 2018 00:30:41 +0100 Subject: [PATCH 1/2] Add note about installing qemu-utils for cloud images --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index e301a2e..037cb5a 100644 --- a/README.md +++ b/README.md @@ -254,6 +254,9 @@ See the man page for a full description of all available commands. You can use cloud images to create virtual machines. The `vm img` command will download the image to datastore and uncompress it if needed (.xz, .tar.gz, and .gz files are supported). The image should be in RAW or QCOW2 format. +To use this feature you'll need install qemu-utils package: + + # pkg install qemu-utils To launch FreeBSD using official cloud image: From 9e561ac284b9f9fe657acf1b6b0867567cc41ab2 Mon Sep 17 00:00:00 2001 From: Mateusz Kwiatkowski Date: Wed, 5 Dec 2018 00:31:04 +0100 Subject: [PATCH 2/2] Check qemu-img exit code --- lib/vm-core | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/vm-core b/lib/vm-core index 5a4d963..8fa0f79 100644 --- a/lib/vm-core +++ b/lib/vm-core @@ -206,6 +206,9 @@ core::write_img(){ # just run start with an iso datastore::img_find "_imgpath" "${_img}" || util::err "unable to locate img file - '${_img}'" qemu-img dd -O raw if="${_imgpath}" of="${_disk_dev}" bs=1M + if [ $? -ne 0 ]; then + util::err "failed to write img file with qemu-img" + fi } # 'vm add'