summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/modules/run-virt/README10
-rwxr-xr-xcore/modules/run-virt/data/opt/openslx/vmchooser/vmchooser-run_virt8
2 files changed, 17 insertions, 1 deletions
diff --git a/core/modules/run-virt/README b/core/modules/run-virt/README
index f009f55a..d079954c 100644
--- a/core/modules/run-virt/README
+++ b/core/modules/run-virt/README
@@ -139,3 +139,13 @@ Note that this is a floppy, not the cloud, so you're limited to 1.44MB of storag
Hook to set up read or write access to image. Here, only *.inc type hooks make sense, since they're
expected to set either VM_DISKFILE_RO or VM_DISKFILE_RW, depending on desired access.
+
+# pre-exec.d/
+
+Hook that is run right before the virtualizer is executed. $1 is the virtualizer ID, $2 is the
+imageuuid.
+
+# post-exec.d/
+
+Hook that is run right after the virtualizer finished executing. $1 is the virtualizer ID, $2 is the
+imageuuid.
diff --git a/core/modules/run-virt/data/opt/openslx/vmchooser/vmchooser-run_virt b/core/modules/run-virt/data/opt/openslx/vmchooser/vmchooser-run_virt
index a2d0f3cb..cf4bc1ca 100755
--- a/core/modules/run-virt/data/opt/openslx/vmchooser/vmchooser-run_virt
+++ b/core/modules/run-virt/data/opt/openslx/vmchooser/vmchooser-run_virt
@@ -177,11 +177,17 @@ main() {
cleanexit 1
fi
+ run_hooks "pre-exec" "$PLUGIN_ID" "$IMGUUID"
+
writelog "VM command: ${VIRTCMD} ${VIRTCMDOPTS[*]}"
# This will start the VM (no eval needed!)
+ local retval
"${VIRTCMD}" "${VIRTCMDOPTS[@]}"
+ retval=$?
+
+ run_hooks "post-exec" "$PLUGIN_ID" "$IMGUUID"
- writelog "Virtualizer exited with '$?'. Bye."
+ writelog "Virtualizer exited with '$retval'. Bye."
cleanexit 0
}