From c1d720d62c7fae11c84530122b5f32c00f62789c Mon Sep 17 00:00:00 2001 From: Mateusz Kwiatkowski Date: Sat, 13 Nov 2021 20:26:19 +0100 Subject: [PATCH] Wait for zvol to appear --- lib/vm-core | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/vm-core b/lib/vm-core index 47e0a1e..a8a9c74 100644 --- a/lib/vm-core +++ b/lib/vm-core @@ -313,9 +313,18 @@ core::write_img(){ shift $? _disk_dev="${1}" _img="$2" + timeout=30 + i=0 # wait a few seconds for newly created zvol device to appear - sleep 2 + while [ $i -lt $timeout ]; do + if [ ! -r "${_disk_dev}" ]; then + sleep 1 + i=$(($i+1)) + else + break + fi + done # just run start with an iso datastore::img_find "_imgpath" "${_img}" || util::err "unable to locate img file - '${_img}'"