From eec193967f7aca562f7d99eaf5d6177f08e9a99e Mon Sep 17 00:00:00 2001 From: Michael Janczyk Date: Sun, 11 Apr 2010 23:08:47 +0200 Subject: virtualization plugin, now with calculation of mem, run-vmgrid and run-virt uses it --- os-plugins/plugins/vmware/files/run-virt.include | 65 +++++++++++++----------- 1 file changed, 35 insertions(+), 30 deletions(-) (limited to 'os-plugins/plugins/vmware/files/run-virt.include') diff --git a/os-plugins/plugins/vmware/files/run-virt.include b/os-plugins/plugins/vmware/files/run-virt.include index dfd07a89..8b91275a 100644 --- a/os-plugins/plugins/vmware/files/run-virt.include +++ b/os-plugins/plugins/vmware/files/run-virt.include @@ -301,36 +301,40 @@ case "$parallel" in esac # adjust memory available for vmware guests -case "$vmversion" in - 2.*) - permem=30 - ;; - 3.*) - permem=25 - ;; -esac -if [ "${totalmem}" -ge "2500" ]; 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 [ -n "${forcemem}" ]; then + mem="${forcemem}" +else + case "$vmversion" in + 2.*) + permem=30 + ;; + 3.*) + permem=25 + ;; + esac 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 -mem=$(expr ${totalmem} / 100 \* ${permem} / 4 \* 4) -if [ "${id44}" = "1" ]; then - memhost=$(expr ${totalmem} - ${mem}) -else - memhost=$(expr ${totalmem} - ${mem} - ${mem}) + # 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 + mem=$(expr ${totalmem} / 100 \* ${permem} / 4 \* 4) + if [ "${id44}" = "1" ]; then + hostmem=$(expr ${totalmem} - ${mem}) + else + hostmem=$(expr ${totalmem} - ${mem} - ${mem}) + fi fi # check if ide/scsi and hwver of image @@ -397,8 +401,8 @@ writelog "# File created by $0 (VMversion ${vmversion})\n# on $(date)\n" writelog "Starting with non-persistent mode ...\n" # check memory range -if [ "${mem}" -lt "256" ] || [ "${memhost}" -lt "256" ]; then - writelog "\tMemory out of range: ${mem} MB (guest) / ${memhost} MB (host)!" +if [ "${mem}" -lt "256" ] || [ "${hostmem}" -lt "256" ]; then + writelog "\tMemory out of range: ${mem} MB (guest) / ${hostmem} MB (host)!" writelog "\tMin. 256 MB for host and guest!" exit 1 fi @@ -420,7 +424,8 @@ if [ -n "${network_card}" ]; then writelog "\tNet Adaptor:\t${network_card}" fi writelog "\tMem:\t\t${mem} MB" -writelog "\tHostmem:\t${memhost} MB" +# echo nur wenn hostmem gesetzt +[ -n "${hostmem}" ] && writelog "\tHostmem:\t${hostmem} MB" writelog "\tMax. res.:\t${xres}x${yres}" writelog "\tCD-ROM1:\t${cdrom0}" writelog "\tCD-ROM2:\t${cdrom1}" -- cgit v1.2.3-55-g7522