summaryrefslogtreecommitdiffstats
path: root/core/modules/run-virt
diff options
context:
space:
mode:
authorSimon Rettberg2019-07-08 12:36:48 +0200
committerSimon Rettberg2019-07-08 12:36:48 +0200
commit8a35d12e356ffd1f49525e1bfd7c61681cd90ff9 (patch)
treec96ef0ea56f20b995fdbfedb54101d2639fc7589 /core/modules/run-virt
parent[vmware-common] Always mangle USB3 speed (diff)
downloadmltk-8a35d12e356ffd1f49525e1bfd7c61681cd90ff9.tar.gz
mltk-8a35d12e356ffd1f49525e1bfd7c61681cd90ff9.tar.xz
mltk-8a35d12e356ffd1f49525e1bfd7c61681cd90ff9.zip
[run-virt] Add --query to check existence of plugin
Diffstat (limited to 'core/modules/run-virt')
-rw-r--r--core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/init_core.inc6
-rwxr-xr-xcore/modules/run-virt/data/opt/openslx/vmchooser/vmchooser-run_virt24
2 files changed, 24 insertions, 6 deletions
diff --git a/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/init_core.inc b/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/init_core.inc
index b724a6f0..cc204d53 100644
--- a/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/init_core.inc
+++ b/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/init_core.inc
@@ -2,12 +2,6 @@
################################################
# Include: Sets core variables and directories #
################################################
-# Global variables needed for the core functionality
-declare -rg VMCHOOSER_DIR="/opt/openslx/vmchooser"
-declare -rg VMCHOOSER_CONF_DIR="$VMCHOOSER_DIR/config"
-declare -rg USER="$(whoami)"
-declare -rg TMPDIR="/tmp/virt/${USER}/$$"
-declare -rg CONFDIR="${TMPDIR}/metadata"
# Check if the path to the logfile was given externally (by the wrapper)
unset WRAPPED
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 4a4b8f16..349f901b 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
@@ -32,6 +32,13 @@ readonly SELF
# Useless without this
. /opt/openslx/config
+# Global variables needed for the core functionality
+declare -rg VMCHOOSER_DIR="/opt/openslx/vmchooser"
+declare -rg VMCHOOSER_CONF_DIR="$VMCHOOSER_DIR/config"
+declare -rg USER="$(whoami)"
+declare -rg TMPDIR="/tmp/virt/${USER}/$$"
+declare -rg CONFDIR="${TMPDIR}/metadata"
+
# Debug mode?
if [ "x$1" = "x--debug" ]; then
shift
@@ -42,6 +49,23 @@ else
DEBUG=false
fi
+# Check for existence of plugin
+if [ "x$1" = "x--query" ]; then
+ PLUGIN_ID="${2//[^a-z_\-]/}"
+ if [ -z "$PLUGIN_ID" ]; then
+ echo "Error: No plugin name given" >&2
+ exit 1
+ fi
+ if ! [ -f "$VMCHOOSER_DIR/plugins/$PLUGIN_ID/run-virt.include" ]; then
+ echo "Plugin '$PLUGIN_ID' does not exist." >&2
+ exit 1
+ fi
+ # Maybe in the future we want to output information about the plugin here
+ # to stdout in a simple to parse format like key=value....
+ echo "Plugin '$PLUGIN_ID' found" >&2
+ exit 0
+fi
+
# This script expects the path to the xml file describing the VM to be started
declare -rg XML_FILE="$1"