summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVolker Uhrig2009-05-29 10:22:31 +0200
committerVolker Uhrig2009-05-29 10:22:31 +0200
commitedec2021d42c8e176db3caaf7e23d1932c88344d (patch)
tree5f4e2558fb4f9d33de593d74485f9fa1f7bd58d5
parentforce svn to add missing libs .. (diff)
downloadcore-edec2021d42c8e176db3caaf7e23d1932c88344d.tar.gz
core-edec2021d42c8e176db3caaf7e23d1932c88344d.tar.xz
core-edec2021d42c8e176db3caaf7e23d1932c88344d.zip
* merged most stuff from runvbox.hints into run-virt.include
* suppress popup messages git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@2902 95ad53e4-c205-0410-b2fa-d234c58c8868
-rw-r--r--os-plugins/plugins/virtualbox/files/run-virt.include103
-rw-r--r--os-plugins/plugins/virtualbox/files/runvbox.hints118
2 files changed, 97 insertions, 124 deletions
diff --git a/os-plugins/plugins/virtualbox/files/run-virt.include b/os-plugins/plugins/virtualbox/files/run-virt.include
index f4c497fd..34793f5d 100644
--- a/os-plugins/plugins/virtualbox/files/run-virt.include
+++ b/os-plugins/plugins/virtualbox/files/run-virt.include
@@ -17,10 +17,47 @@
# include general configuration from vmchooser
. /etc/opt/openslx/run-virt.include
-# most of the following does not make much sense yet ...
-permem=66
-mem=$(expr{totalmem} * ${permem})
+# memory part equal to vmware plugin
+# percentage of memory to use for virtualbox in standard case
+permem=30
+if [ "${totalmem}" -ge "1600" ]; then
+ permem=40
+fi
+# check if /tmp is on harddisk
+if grep -qe "/dev/.* /tmp " /proc/mounts ; then
+ permem=60
+ id44="1"
+ # Hack, if more than 2,5G RAM use 40% of Ram and write vmem into Ram as well
+ # (40% vmware | 40% confdir(vmem...) | 20% host
+ # VMplayer 2+ issue
+ #if [ "${totalmem}" -ge "2500" ]; then
+ # permem=40
+ # confdir=/dev/shm/vmware/$USER
+ # conffile=${confdir}/run-vmware.conf
+ # mkdir -p /dev/shm/vmware/$USER
+ #fi
+fi
+#TODO: ... / 4 * 4 dont make sence
+mem=$(expr ${totalmem} / 100 \* ${permem} / 4 \* 4)
+if [ "${id44}" = "1" ]; then
+ memhost=$(expr ${totalmem} - ${mem})
+else
+ memhost=$(expr ${totalmem} - ${mem} - ${mem})
+fi
+
+#permem=40
+#mem=$(expr ${totalmem} * ${permem})
+
+if [ "${mem}" -lt "256" ] || [ "${memhost}" -lt "256" ]; then
+ writelog "\tMemory out of range: ${mem} MB (guest) / ${memhost} MB (host)!"
+ writelog "\tMin. 256 MB for host and guest!"
+ exit 1
+fi
+
+
+# most of the following does not make much sense yet ...
+#
# virtual fd/cd/dvd and drive devices, floppy b: for configuration
# if $floppy_0 from run-virt.include set then fdtest="TRUE"
fdtest=
@@ -44,12 +81,64 @@ cdrom1=${cdtest:-"FALSE"}
ide="TRUE"
hddrv="ide"
-# finally set env for run-virt.sh
+
+################################################################################
+### Pepare env and and configure Image
################################################################################
-# set the variables appropriately (several interfaces with different names)
-VIRTCMD=$(which virtualbox 2>/dev/null)
-# VIRTCMDOPTS="${vmopt} ${conffile}"
+# Current ID, to make sure it won't run into conflicts if started more
+# as once at the same time, else delete would make the trick...
+ID=$$
+# Don't use $HOME/.VirtualBox!
+export VBOX_USER_HOME="/tmp/vbox-${USER}-${ID}"
+
+# Import Image to VirtualBox, which won't get changed
+VBoxManage -q registerimage disk ${diskfile} -type immutable
+
+# Get ID of VBox Image...
+diskuid="$(VBoxManage -q showvdiinfo ${diskfile} |grep UUID|awk '{ print $2; }')"
+# Create Image and register it, so we are able to modify and start it
+VBoxManage createvm -name "${ID}" -register
+
+################################################################################
+###
+### Modify VM
+###
+################################################################################
+
+## Add harddisk
+VBoxManage -q modifyvm "${ID}" -hda ${diskuid}
+
+## Configure VM memory
+VBoxManage -q modifyvm "${ID}" -memory ${mem}
+
+## Add cddrives
+## TODO: merge to new version, where run-virt.include has our drives
+#VBoxManage -q modifyvm "${ID}" -dvd host:${cdrs}
+
+# Enable hardware virtualization
+# TODO: check if CPU supports hw virtualization
+#VBoxManage -q modifyvm "${ID}" -hwvirtex on
+
+# HDD as boot device
+VBoxManage -q modifyvm "${ID}" -boot1 disk
+# enable audio (oss|null|none|alsa|pulse). OSS is backwardcompatible to v2.0
+VBoxManage -q modifyvm "${ID}" -audio oss
+# supress License and Message
+# TODO: Not clear if we are allowed to do this
+VBoxManage setextradata global "GUI/LicenseAgreed" "7"
+VBoxManage setextradata global "GUI/SuppressMessages" ",remindAboutAutoCapture"
+VBoxManage setextradata global "GUI/RegistrationData" "triesLeft=0"
+
+
+
+# finally set env for run-virt.sh
+################################################################################
+
+# set the variables appropriately (several interfaces with different names)
+#VIRTCMD=$(which virtualbox 2>/dev/null)
+VIRTCMD=$(which VBoxManage 2>/dev/null)
+VIRTCMDOPTS="startvm ${ID} -type gui"
diff --git a/os-plugins/plugins/virtualbox/files/runvbox.hints b/os-plugins/plugins/virtualbox/files/runvbox.hints
index ebc57003..b58c1f62 100644
--- a/os-plugins/plugins/virtualbox/files/runvbox.hints
+++ b/os-plugins/plugins/virtualbox/files/runvbox.hints
@@ -1,73 +1,4 @@
-#!/bin/sh
-# Description: Script for preparing VirtualBox environment Diskless
-# Gets a xml file, reads needed information from it and
-# forwards it into B drive of VirtualBox
-#
-# Author(s): see project authors file
-# last changes uhrig, 21/10/2008
-# Copyright: (c) 2003 - 2008 - RZ Universitaet Freiburg
-#
-# Version: 0.0.1
-#
-################################################################################
-
-################################################################################
-##
-## Read needed variables from XML file
-##
-################################################################################
-xml=$1
-# todo: change it! We need to mount it like vmware, but it could be the
-# same
-imgpath="/var/lib/vmware"
-
-# file name of the image
-imagename="${imgpath}/$(grep -i "<image_name param=\"" ${xml} | awk -F "\"" '{ print $2 }')"
-imagename="${imgpath}/vbox-winxppro_20gb.vdi"
-
-# define name for VirtualBox window. no utf8, perhaps we don't need it any
-# more. else change the next two lines
-#short_description=$(grep "short_description param=\"" ${xml} | sed -e "s%&.*;%; %g" | awk -F "\"" '{print $2}')
-# if ${short_description} not defined use ${image_name}
-#short_description=${short_description:-"${image_name}"}
-#displayname=${short_description}
-
-# Definition of the client system
-#vmostype=$(grep -i "<os param=\"" ${xml} | awk -F "\"" '{ print $2 }')
-
-# Definition of the network kind. we should only need: nat, hostif
-network_kind=$(grep -i "<network param=\"" ${xml} | awk -F "\"" '{ print $2 }')
-network_kind="nat"
-# compatibility to vmware xml's
-if [ ${network_kind} = "bridge" ]; then
- network_kind="hostif"
-else
- # wrong configuration or nat, hostonly currently not supported, do we
- # really need it?
- network_kind="nat"
-fi
-
-################################################################################
-##
-## Prepare stuff and configure Image
-##
-################################################################################
-
-# Don't use $HOME/.VirtualBox!
-export VBOX_USER_HOME=/tmp/vbox-${USER}-$$
-# Current ID, to make sure it won't run into conflicts if started more
-# as once at the same time, else delete would make the trick...
-ID=$$
-
-# Bind Image to VirtualBox, which won't get changed
-VBoxManage registerimage disk ${imagename} -type immutable
-
-# Get ID of VBox Image...
-diskuid="$(VBoxManage showvdiinfo ${imagename} |grep UUID|awk '{ print $2; }')"
-
-# Create Image and register it, so we are able to modify and start it
-VBoxManage createvm -name "${ID}" -register
-
+# Description: Old example script
################################################################################
##
@@ -75,39 +6,6 @@ VBoxManage createvm -name "${ID}" -register
##
################################################################################
-# Add harddisk
-VBoxManage modifyvm "${ID}" -hda ${diskuid}
-
-## check if we have enough free memory
-# get memory in MB
-totalmem=$(expr $(grep -i "memtotal" /proc/meminfo | awk '{print $2}') / 1024)
-# calculate memory for virtualbox
-mem=$(expr ${totalmem} / 100 \* 66 / 4 \* 4)
-# check memory range
-memtest=${totalmem}-128
-
-if [ "${mem}" -lt "128" ] || [ "${mem}" -gt "${totalmem}" ]; then
- echo "\n\n"
- echo "\tYour memory is out of range: ${mem} MB."
- echo "\tMin. 128 MB for host and guest!"
- exit 1
-fi
-VBoxManage modifyvm "${ID}" -memory ${mem}
-
-
-## look for cdrom, dvd and add them to the vm config file
-for cdrs in /dev/cdrom*; do
- if [ -L ${cdrs} ]; then
- VBoxManage modifyvm "${ID}" -dvd host:${cdrs}
- fi
-done
-
-# Enable hardware virtualization
-VBoxManage modifyvm "${ID}" -hwvirtex on
-
-# HDD as boot device
-VBoxManage modifyvm "${ID}" -boot1 disk
-
# Network settings
VBoxManage modifyvm "${ID}" -nic1 ${network_kind}
#VBoxManage modifyvm "${ID}" -nictype1 Am79C970a|aM79c973|82540em
@@ -120,9 +18,6 @@ fi
# else we should use
#VBoxManage modifyvm "${ID}" -macaddress1 <mac>
-# enable audio
-VBoxManage modifyvm "${ID}" -audio oss
-
#TODO
#VBoxManage modifyvm "${ID}"
#VBoxManage modifyvm "${ID}" ­ostype <ostype>
@@ -132,14 +27,3 @@ VBoxManage modifyvm "${ID}" -audio oss
#VBoxManage modifyvm "${ID}" ­dvdpassthrough <on|off> # burn support, unstable
#VBoxManage modifyvm "${ID}" -floppy empty|uuid|filename # yes we need it
#VBoxManage modifyvm "${ID}" -floppy empty|uuid|filename # yes we need it
-
-
-
-# adjust volume amixer -q sset Master 28 unmute 2>/dev/null
-amixer -q sset PCM 28 unmute 2>/dev/null
-amixer -q sset Headphone 28 unmute 2>/dev/null
-amixer -q sset Front 0 mute 2>/dev/null
-
-
-# start created image
-VBoxManage startvm "${ID}" -type gui