diff options
author | Sebastian Schmelzer | 2010-09-02 17:50:49 +0200 |
---|---|---|
committer | Sebastian Schmelzer | 2010-09-02 17:50:49 +0200 |
commit | 416ab8a37f1b07dc9f6c0fb3ff1a8ff2036510b5 (patch) | |
tree | 4715f7d742fec50931017f38fe6ff0a89d4ceccc /os-plugins/plugins/vmgrid/init-hooks/80-after-plugins/virtualization.sh | |
parent | Fix for the problem reported on the list (sed filter forgotten for the (diff) | |
download | core-416ab8a37f1b07dc9f6c0fb3ff1a8ff2036510b5.tar.gz core-416ab8a37f1b07dc9f6c0fb3ff1a8ff2036510b5.tar.xz core-416ab8a37f1b07dc9f6c0fb3ff1a8ff2036510b5.zip |
change dir structure
Diffstat (limited to 'os-plugins/plugins/vmgrid/init-hooks/80-after-plugins/virtualization.sh')
-rw-r--r-- | os-plugins/plugins/vmgrid/init-hooks/80-after-plugins/virtualization.sh | 144 |
1 files changed, 0 insertions, 144 deletions
diff --git a/os-plugins/plugins/vmgrid/init-hooks/80-after-plugins/virtualization.sh b/os-plugins/plugins/vmgrid/init-hooks/80-after-plugins/virtualization.sh deleted file mode 100644 index 73a65ac5..00000000 --- a/os-plugins/plugins/vmgrid/init-hooks/80-after-plugins/virtualization.sh +++ /dev/null @@ -1,144 +0,0 @@ -# Copyright (c) 2010 - RZ Uni Freiburg -# Copyright (c) 2010 - OpenSLX GmbH -# -# This program/file 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 feedback to feedback@openslx.org -# -# General information about OpenSLX can be found at http://openslx.org -# -# script is included from init via the "." load function - thus it has all -# variables and functions available - -# virtual virtualization plugin -# make sure that this file is the same in vmgrid and vmchooser plugin! - -# include default directories -. /etc/openslx.conf - -CONFFILEVMCHOOSER="/initramfs/plugin-conf/vmchooser.conf" -CONFFILEVMGRID="/initramfs/plugin-conf/vmgrid.conf" -PLUGINCONFDIR=/mnt/${OPENSLX_DEFAULT_CONFDIR}/plugins/virtualization - -# check if plugins available -active=0 -[ -f ${CONFFILEVMCHOOSER} ] && . ${CONFFILEVMCHOOSER} -[ "x${vmchooser_active}" = "x1" ] && active=1 -[ -f ${CONFFILEVMGRID} ] && . ${CONFFILEVMGRID} -[ "x${vmgrid_active}" = "x1" ] && active=1 - -[ $DEBUGLEVEL -gt 0 ] \ - && echo -e "Executing the 'virtualization' plugin ... \c" - -if [ ${active} -ne 0 ] ; then - - # load general configuration - . /etc/initramfs-setup - # include functions - . /etc/functions - - testmkd ${PLUGINCONFDIR} - - # check if vmgrid active and change free mem - totalmem=$(expr $(grep -i "memtotal" /proc/meminfo \ - | awk '{print $2}') / 1024) - echo "totalmem=${totalmem}" >> ${PLUGINCONFDIR}/virtualization.conf - - if [ "x${vmgrid_active}" = "x1" ]; then - - totalmemtest=$(expr $(echo ${vmgrid_memratio} \ - | awk -F ',' '{print $1" + "$2" + "$3" + "$4" + "$5" + "$6}')) - - # not more than 100% memory assigned - if [ ${totalmemtest} -le 100 2>/dev/null ]; then - - # host mem - hostratio=$(echo ${vmgrid_memratio} | awk -F ',' '{print $6}') - hostmem=$(expr ${totalmem} \* ${hostratio} / 100 2>/dev/null) - if [ ${hostmem} -lt 256 2>/dev/null ]; then - # min. 256 MB for host - hostmem=256 - fi - - # main vm mem (vmchooser) - if [ "x${vmchooser_active}" = "x1" ]; then - mainvirtratio=$(echo ${vmgrid_memratio} | awk -F ',' '{print $5}') - mainvirtmem=$(expr ${totalmem} \* ${mainvirtratio} / 100 2>/dev/null) - if [ ${mainvirtmem} -lt 512 2>/dev/null ]; then - # min. 512 for vmchooser - mainvirtmem=512 - fi - else - mainvirtratio=0 - mainvirtmem=0 - fi - - cat << EOF >> ${PLUGINCONFDIR}/virtualization.conf -hostratio=${hostratio} -hostmem=${hostmem} -mainvirtratio=${mainvirtratio} -mainvirtmem=${mainvirtmem} -EOF - - fi - fi - - # cpu cores - CPU_CORES=$(grep 'processor.*:' /proc/cpuinfo | wc -l) - if [ "${CPU_CORES}" -gt "1" 2>/dev/null ]; then - echo "cpu_cores=${CPU_CORES}" \ - >> ${PLUGINCONFDIR}/virtualization.conf - else - echo 'cpu_cores=1' >> ${PLUGINCONFDIR}/virtualization.conf - fi - - # arch - echo "host_arch=$(uname -m)" >> ${PLUGINCONFDIR}/virtualization.conf - - # VT enabled cpu? - if grep -q ^flags.*\\\<vmx\\\> /proc/cpuinfo; then - echo "vtflag=1" >> ${PLUGINCONFDIR}/virtualization.conf - echo 'kvm_module="kvm_intel"' >> ${PLUGINCONFDIR}/virtualization.conf - elif grep -q ^flags.*\\\<svm\\\> /proc/cpuinfo; then - echo "vtflag=1" >> ${PLUGINCONFDIR}/virtualization.conf - echo 'kvm_module="kvm_amd"' >> ${PLUGINCONFDIR}/virtualization.conf - else - echo "vtflag=0" >> ${PLUGINCONFDIR}/virtualization.conf - fi - - # write mac - echo "hostmacaddr=${macaddr}" >> ${PLUGINCONFDIR}/virtualization.conf - # ip addr - echo "hostip=${clientip}" >> ${PLUGINCONFDIR}/virtualization.conf - # hostname - echo "hostname=${host_name}" >> ${PLUGINCONFDIR}/virtualization.conf - - # get further hw information - waitfor /etc/hwinfo.cdrom - j=0 - for i in $(cat /etc/hwinfo.cdrom); do - echo "cdrom_$j=$i" >> ${PLUGINCONFDIR}/virtualization.conf - j=$(expr $j + 1) - done - - waitfor /etc/hwinfo.floppy - j=0 - for i in $(cat /etc/hwinfo.floppy); do - echo "floppy_$j=$i" >> ${PLUGINCONFDIR}/virtualization.conf - j=$(expr $j + 1) - done - - # copy host information to rwshare of vmgrid plugin - if [ "x${vmgrid_active}" = "x1" ]; then - cp ${PLUGINCONFDIR}/virtualization.conf ${vmgrid_rwmnt}/host.conf - fi - - # finished ... - [ $DEBUGLEVEL -gt 0 ] \ - && echo "ok" -else - [ $DEBUGLEVEL -gt 0 ] \ - && echo "failed" -fi |