summaryrefslogtreecommitdiffstats
path: root/os-plugins/plugins
diff options
context:
space:
mode:
authorMichael Janczyk2010-03-20 19:15:02 +0100
committerMichael Janczyk2010-03-20 19:15:02 +0100
commitaab97df6ee70674b995bea14b60fbf3019ace8ef (patch)
treeced49acb6cbf0026023f97bcbb4da5ef68e1b6d6 /os-plugins/plugins
parentvirtualbox, vmgrix und xen anpassungen, jetzt auch geadded (diff)
downloadcore-aab97df6ee70674b995bea14b60fbf3019ace8ef.tar.gz
core-aab97df6ee70674b995bea14b60fbf3019ace8ef.tar.xz
core-aab97df6ee70674b995bea14b60fbf3019ace8ef.zip
added rw share support for vmgrid and virtualbox
Diffstat (limited to 'os-plugins/plugins')
-rw-r--r--os-plugins/plugins/virtualbox/files/machine.include4
-rw-r--r--os-plugins/plugins/virtualbox/files/run-virt.include10
-rw-r--r--os-plugins/plugins/vmgrid/XX_vmgrid.sh39
-rw-r--r--os-plugins/plugins/vmgrid/files/run-vmgrid.sh5
-rwxr-xr-xos-plugins/plugins/vmgrid/files/xmlfilter.sh50
5 files changed, 49 insertions, 59 deletions
diff --git a/os-plugins/plugins/virtualbox/files/machine.include b/os-plugins/plugins/virtualbox/files/machine.include
index 7488126a..bc1817de 100644
--- a/os-plugins/plugins/virtualbox/files/machine.include
+++ b/os-plugins/plugins/virtualbox/files/machine.include
@@ -60,7 +60,9 @@ cat <<EOF
<Port slot="1" enabled="false" IOBase="0x378" IRQ="4"/>
</LPT>
<AudioAdapter controller="AC97" driver="Alsa" enabled="true"/> <!-- OSS, Alsa, Pulse (HANGS!) -->
- <SharedFolders/>
+ <SharedFolders>
+ <SharedFolder name="Home" hostPath="/home/${USER}" writable="true"/>
+ </SharedFolders>
<Clipboard mode="Bidirectional"/>
<Guest memoryBalloonSize="0" statisticsUpdateInterval="0"/>
<!--
diff --git a/os-plugins/plugins/virtualbox/files/run-virt.include b/os-plugins/plugins/virtualbox/files/run-virt.include
index 44a749cb..a24845a3 100644
--- a/os-plugins/plugins/virtualbox/files/run-virt.include
+++ b/os-plugins/plugins/virtualbox/files/run-virt.include
@@ -203,6 +203,7 @@ writelog "\tNetwork kind:\t\t${network_kind}"
#writelog "\tCD-ROM1:\t${cdrom0}"
#writelog "\tCD-ROM2:\t${cdrom1}"
#writelog "\tFloppy_A:\t${floppy0}"
+writelog "\tShared Folders 'Home':\t/home/${USER}"
################################################################################
### Pepare and configure virtual machine and disk image
@@ -216,6 +217,15 @@ writelog "\tNetwork kind:\t\t${network_kind}"
#date=${date%T*}
. ${PLUGINCONFVIRTUALBOX}/machine.include >"${machconfig}"
+# add rw share to vm, if existing
+if [ -n "${rwshare}" ]; then
+ sharedf='<SharedFolder name="Share"'
+ sharedf="${sharedf} hostPath=\"${rwshare}\" writable=\"true\"/>"
+ sed -i "s,</SharedFolders>, ${sharedf}\n </SharedFolders>," \
+ "${machconfig}"
+ writelog "\tShared Folders 'Share':\t${rwshare}"
+fi
+
# add ssh port if linux and NAT
if [ "${vmostype}" = "Linux26" ] && [ "${network_kind}" = "NAT" ]; then
vmsshport="220${VM_ID}"
diff --git a/os-plugins/plugins/vmgrid/XX_vmgrid.sh b/os-plugins/plugins/vmgrid/XX_vmgrid.sh
index 7aa7dba5..004b7891 100644
--- a/os-plugins/plugins/vmgrid/XX_vmgrid.sh
+++ b/os-plugins/plugins/vmgrid/XX_vmgrid.sh
@@ -15,17 +15,26 @@
# include default directories
. /etc/openslx.conf
+# include functions
+. /etc/functions
+
+# hostname?
+[ -e /tmp/confviadhcp ] && . /tmp/confviadhcp
+host_name=${host_name:=$clientip}
+
CONFFILE="/initramfs/plugin-conf/vmgrid.conf"
PLUGINCONFDIR=/mnt/${OPENSLX_DEFAULT_CONFDIR}/plugins/vmgrid
VIRTUALIZATIONPLUGIN=/mnt/${OPENSLX_DEFAULT_CONFDIR}/plugins/virtualization
-RWSHARE=/mnt/${OPENSLX_DEFAULT_VARDIR}/plugins/vmgrid/share
+#RWSHARE=/mnt/${OPENSLX_DEFAULT_VARDIR}/plugins/vmgrid/share
+RWSHARE=/mnt/var/opt/openslx/plugins/vmgrid/share
+RWSHAREMNT=/mnt/var/opt/openslx/mnt/vmgrid
BINDIR=/mnt/${OPENSLX_DEFAULT_BINDIR}
PLUGINDIR=${OPENSLX_DEFAULT_DIR}/plugin-repo/vmgrid
VIRTDIR=/mnt/${OPENSLX_DEFAULT_VIRTDIR}/vmgrid
LOGDIR=/mnt/${OPENSLX_DEFAULT_LOGDIR}
if [ -f $CONFFILE ]; then
-
+
# load needed variables
. $CONFFILE
@@ -58,23 +67,39 @@ if [ -f $CONFFILE ]; then
fi
fi
+ # create rw share
+ testmkd ${RWSHARE}
# bind mount id 45 to ${RWSHARE}
if strinstr "id45" "${vmgrid_rwshare}" ; then
- if grep "/mnt/var/scratch " /proc/mounts; then
- mount --bind -n /mnt/var/scratch ${RWSHARE} >${LOGDIR}/vmgrid.log 2>&1
+ id45part=$(grep " 45 " /etc/disk.partition | awk '{print $1}' | \
+ cut -f 3,3 -d /)
+ if [ -n "${id45part}" ]; then
+ testmkd /mnt/media/${id45part}/vmgrid
+ mount --bind -n /mnt/media/${id45part}/vmgrid ${RWSHARE} \
+ >>${LOGDIR}/vmgrid.log 2>&1
fi
# mount nfs rw share
elif strinstr "nfs://" "${vmgrid_rwshare}" ; then
rwshareprot=$(uri_token ${vmgrid_rwshare} prot)
rwshareserv=$(uri_token ${vmgrid_rwshare} server)
rwsharepath="$(uri_token ${vmgrid_rwshare} path)"
- if [ -n "${rwshareprot}" -a -n "${rwshareserv}"-a -n "${rwsharepath}" ];
- then
- rwtarget=${RWSHARE}
+ if [ -n "${rwshareprot}" -a -n "${rwshareserv}" -a -n "${rwsharepath}" ];
+ then
+ # mount to a dir fist to create spec host dir, then bind mount
+ testmkd ${RWSHAREMNT}
+ rwtarget=${RWSHAREMNT}
# mount the vmgrid source rw
fsmount ${rwshareprot} ${rwshareserv} ${rwsharepath} ${rwtarget} rw
+ testmkd ${RWSHAREMNT}/${host_name}
+ mount --bind ${RWSHAREMNT}/${host_name} ${RWSHARE} \
+ >>${LOGDIR}/vmgrid.log 2>&1
fi
+ else
+ testmkd /mnt/tmp/vmgrid
+ mount --bind -n /mnt/tmp/vmgrid ${RWSHARE} >>${LOGDIR}/vmgrid.log 2>&1
fi
+ # chmod so that everybody can write
+ chmod 1777 ${RWSHARE}
# TODO: virtual virtualization plugin
diff --git a/os-plugins/plugins/vmgrid/files/run-vmgrid.sh b/os-plugins/plugins/vmgrid/files/run-vmgrid.sh
index c8ebb1a1..386695bf 100644
--- a/os-plugins/plugins/vmgrid/files/run-vmgrid.sh
+++ b/os-plugins/plugins/vmgrid/files/run-vmgrid.sh
@@ -265,7 +265,10 @@ ide="TRUE"
scsi="FALSE"
hddrv="ide"
-# TODO: vncclient IP:55101
+# TODO: vncclient IP:59001 oder Plugin?
+
+# add rw share
+rwshare="/var/opt/openslx/plugins/vmgrid/share"
# set hostname: using original hostname and adding string
hostname="vmgrid${VM_ID}-$(hostname)"
diff --git a/os-plugins/plugins/vmgrid/files/xmlfilter.sh b/os-plugins/plugins/vmgrid/files/xmlfilter.sh
deleted file mode 100755
index 5196992c..00000000
--- a/os-plugins/plugins/vmgrid/files/xmlfilter.sh
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/bin/bash
-# -----------------------------------------------------------------------------
-# Copyright (c) 2007..2009 - RZ Uni FR
-# Copyright (c) 2007..2009 - OpenSLX GmbH
-#
-# This program is free software distributed under the GPL version 2.
-# See http://openslx.org/COPYING
-#
-# If you have any feedback please consult http://openslx.org/feedback and
-# send your suggestions, praise, or complaints to feedback@openslx.org
-#
-# General information about OpenSLX can be found at http://openslx.org/
-# -----------------------------------------------------------------------------
-# xmlfilter.sh
-# - This script is invoked by the vmchooser tool. It simply filters xml-
-# files (taking the path to these files in $1). You might modify it in any
-# way to match your needs, e.g. ask some database instead. You can re-
-# implement it in any other programming language too. You simply have to
-# return a list of proper xml files to be interpreted by the vmchooser
-# binary). Please check for vmchooser.sh too ...
-# -----------------------------------------------------------------------------
-
-# This script .
-#
-# currently:
-# - filter for slxgrp (which comes from /etc/machine-setup)
-#
-
-# include default directories
-. /etc/opt/openslx/openslx.conf
-
-if [ -f ${OPENSLX_DEFAULT_CONFDIR}/plugins/vmchooser/vmchooser.conf ]; then
- . ${OPENSLX_DEFAULT_CONFDIR}/plugins/vmchooser/vmchooser.conf
-fi
-
-for FILE in $1/*.xml; do
- # filter all xmls which aren't set active
- if [ $(grep "<active param=.*true.*" ${FILE} | wc -l) -eq 1 ]; then
- if [ -n ${vmchooser_env} ]; then
- # filter all xmls with pool-param not equal to vmchooser::env
- if [ $(grep "<pools param=\"${vmchooser_env}\"" ${FILE} | wc -l) -eq 1 ];\
- then
- echo ${FILE};
- fi
- else
- # if there is no pool set, just take all available xmls
- echo -e ${active}
- fi
- fi
-done