summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xautocluster4
-rw-r--r--config.d/05diskimage_loopback.defconf13
2 files changed, 13 insertions, 4 deletions
diff --git a/autocluster b/autocluster
index dd70f88..de7c840 100755
--- a/autocluster
+++ b/autocluster
@@ -1181,10 +1181,6 @@ trap 'es=$?;
# check for needed programs
check_command expect
-if [ "$SYSTEM_DISK_FORMAT" = "qcow2" ] ; then
- check_command $QEMU_NBD
- check_command nbd-client
-fi
[ $# -lt 1 ] && usage
diff --git a/config.d/05diskimage_loopback.defconf b/config.d/05diskimage_loopback.defconf
index be49e88..6958092 100644
--- a/config.d/05diskimage_loopback.defconf
+++ b/config.d/05diskimage_loopback.defconf
@@ -145,6 +145,19 @@ diskimage_mv_loopback ()
######################################################################
+diskimage_loopback_sanity_check ()
+{
+ if [ "$SYSTEM_DISK_FORMAT" = "qcow2" -a \
+ "$SYSTEM_DISK_ACCESS_METHOD" = "loopback" ] ; then
+ check_command $QEMU_NBD
+ check_command nbd-client
+ fi
+}
+
+register_hook post_config_hooks diskimage_loopback_sanity_check
+
+######################################################################
+
# Private functions
# mount a qemu image via nbd