summaryrefslogtreecommitdiffstats
path: root/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/setup_vm_hypervisor.inc
diff options
context:
space:
mode:
authorJonathan Bauer2017-01-25 18:32:35 +0100
committerJonathan Bauer2017-01-25 18:32:35 +0100
commiteea5898961a40fc50f01356f90c42904a73a3f74 (patch)
tree52c19d11efc2d7d904ac89e36ff271de305cfc5a /core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/setup_vm_hypervisor.inc
parent[pam] Include cifs.upcall for DFS support (diff)
downloadmltk-eea5898961a40fc50f01356f90c42904a73a3f74.tar.gz
mltk-eea5898961a40fc50f01356f90c42904a73a3f74.tar.xz
mltk-eea5898961a40fc50f01356f90c42904a73a3f74.zip
major run-virt restructure, only vmware plugin tested!
Diffstat (limited to 'core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/setup_vm_hypervisor.inc')
-rw-r--r--core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/setup_vm_hypervisor.inc40
1 files changed, 12 insertions, 28 deletions
diff --git a/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/setup_vm_hypervisor.inc b/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/setup_vm_hypervisor.inc
index 7709a85d..80b7dbb9 100644
--- a/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/setup_vm_hypervisor.inc
+++ b/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/setup_vm_hypervisor.inc
@@ -1,34 +1,18 @@
##########################################################################
# Include: Setup virtual machine hypervisor via vm-specific include file #
##########################################################################
-
-# Get all virtual machine specific stuff from the respective include file
-if [ ! -e "$VMCHOOSER_DIR/$PLUGIN_ID/run-virt.include" ] ; then
- slxlog "virt-plugin-missing" "Could not find run-virt.include for $PLUGIN_ID ($VMCHOOSER_DIR/$PLUGIN_ID/run-virt.include)"
- writelog "Failed because of missing ${PLUGIN_ID} plugin."
- error_user "Konnte den Virtualisierer '$PLUGIN_ID' nicht finden. Starten der Virtuellen Maschine fehlgeschlagen.
- Starten Sie den Computer neu und wenden Sie sich an den Support, wenn das Problem weiterhin besteht."
- cleanexit 1
-fi
-
-self="${PLUGIN_ID}"
-
-if ! bash -n "$VMCHOOSER_DIR/$PLUGIN_ID/run-virt.include"; then
- slxlog "virt-plugin-syntax" "run-virt.include for $PLUGIN_ID contains syntax errors (bash -n run-virt.include failed)"
- writelog "Erroneous run-virt.include for $PLUGIN_ID (syntax check)"
- error_user "Das Start-Script für den Virtualisierer '$PLUGIN_ID' ist fehlerhaft.
- Starten Sie den Computer neu und wenden Sie sich an den Support, wenn das Problem weiterhin besteht."
- cleanexit 1
-fi
-
-setup_vm_commandline () {
- # Now including the hypervisor specific include file:
- if ! source "$VMCHOOSER_DIR/$PLUGIN_ID/run-virt.include"; then
- slxlog "virt-plugin-error" "run-virt.include for $PLUGIN_ID could not be sourced properly."
- writelog "Erroneous run-virt.include for ${PLUGIN_ID}? Source returned != 0"
- error_user "Das Start-Script für den Virtualisierer '$PLUGIN_ID' hat einen fehlercode zurückgegeben.
- Starten Sie den Computer neu, falls es beim Ausführen der VM zu Problemen kommt
- und wenden Sie sich an den Support, wenn das Problem weiterhin besteht."
+## Functions ##
+setup_vm_commandline() {
+ # Sanity checks
+ if ! isset PLUGIN_ID; then
+ writelog "Sanity check failed: PLUGIN_ID is not set."
+ EXIT_TYPE="internal" EXIT_REASON="Konnte kein Virtualisierer für das gewählte Image ermitteln!" cleanexit 1
+ fi
+ if ! $(safesource "$VMCHOOSER_DIR/plugins/$PLUGIN_ID/run-virt.include"); then
+ # safesource logs errors on its own
+ EXIT_TYPE="internal" EXIT_REASON="Konnte Virtualisierungsplugin '$PLUGIN_ID' nicht initialisieren!" cleanexit 1
fi
}
+## Main ##
+call_post_source setup_vm_commandline