summaryrefslogtreecommitdiffstats
path: root/remote/modules/vbox/data/opt/openslx/vmchooser/virtualbox/run-virt.include
diff options
context:
space:
mode:
authorChristian Rößler2014-04-16 16:25:12 +0200
committerChristian Rößler2014-04-16 16:25:12 +0200
commit69d83b7d9b33eac7b3be999c3cb1c2b80fedeaf0 (patch)
treecdbec5817f839008c02bcad8023e00030a6c7a56 /remote/modules/vbox/data/opt/openslx/vmchooser/virtualbox/run-virt.include
parentMerge branch 'master' of git.openslx.org:openslx-ng/tm-scripts (diff)
downloadtm-scripts-69d83b7d9b33eac7b3be999c3cb1c2b80fedeaf0.tar.gz
tm-scripts-69d83b7d9b33eac7b3be999c3cb1c2b80fedeaf0.tar.xz
tm-scripts-69d83b7d9b33eac7b3be999c3cb1c2b80fedeaf0.zip
[vbox] Adapted config files, cosmetic changes etc.
Diffstat (limited to 'remote/modules/vbox/data/opt/openslx/vmchooser/virtualbox/run-virt.include')
-rwxr-xr-xremote/modules/vbox/data/opt/openslx/vmchooser/virtualbox/run-virt.include75
1 files changed, 26 insertions, 49 deletions
diff --git a/remote/modules/vbox/data/opt/openslx/vmchooser/virtualbox/run-virt.include b/remote/modules/vbox/data/opt/openslx/vmchooser/virtualbox/run-virt.include
index 22c62513..161fcf5a 100755
--- a/remote/modules/vbox/data/opt/openslx/vmchooser/virtualbox/run-virt.include
+++ b/remote/modules/vbox/data/opt/openslx/vmchooser/virtualbox/run-virt.include
@@ -19,13 +19,10 @@
################################################################################
VMCHOOSERVBOX="/opt/openslx/vmchooser/${self}"
-# create TMPDIR for all users
-TMPDIR=/tmp/virt/${self}
+TMPDIR=/tmp/virt/${self} # create TMPDIR for all users
mkdir -m 1777 ${TMPDIR} 2>/dev/null
-# dir for configs
-confdir="/tmp/virt/${self}/${USER}/${VM_ID}"
-# use alternate configuration directory instead of $HOME/.VirtualBox
-export VBOX_USER_HOME=${confdir}
+confdir="/tmp/virt/${self}/${USER}/${VM_ID}" # dir for configs
+export VBOX_USER_HOME=${confdir} # instead of $HOME/.VirtualBox
# define dirs and files which can be removed after exit, be carefull!
RMDIRS="${snapshotdir} ${confdir} /tmp/virt/.vbox-${USER}-ipc"
rm -rf ${RMDIRS} 2>/dev/null
@@ -35,21 +32,15 @@ machconfig="${machfolder}/${vm_shortname}/${vm_shortname}.xml"
diskfolder="${confdir}/HardDisks"
snapshotdir=${machfolder}/${vm_shortname}/Snapshots
mkdir -p ${diskfolder} ${snapshotdir} 2>/dev/null
-# check if diskless var empty?
-[ -z "${diskless}" ] && diskless=0
-# default guest audio controller (SB16, AC97, HDA)
-guestaudio="HDA"
-# default guest network adaptor (Am79C970A, Am79C973, 82540EM)
-vb_network_card="82540EM"
-# default setting for accelerated 2D grapics (OS dependent)
-enable2d="true"
-# set default graphics ram
-vram="128"
+[ -z "${diskless}" ] && diskless=0 # check if diskless var empty?
+guestaudio="HDA" # default guest audio controller (SB16, AC97, HDA)
+vb_network_card="82540EM" # default guest network adaptor (Am79C970A, Am79C973, 82540EM)
+enable2d="true" # default setting for accelerated 2D grapics (OS dependent)
+vram="128" # set default graphics ram
# configure our own rwimg, empty image which we provide
if [ "${imgmode}" = "rwimg" ]; then
- # what is our rwimg called?
- imgname="${vm_shortname}.vdi"
+ imgname="${vm_shortname}.vdi" # what is our rwimg called?
vmpath=${imgpath}/${imgname}
if ! [ -e "${vmpath}" ]; then
cat /opt/openslx/vmchooser/virtualbox/rwimg.vdi.gz | gunzip > "${vmpath}"
@@ -68,12 +59,9 @@ elif [ ${diskless} -eq 0 ]; then
cleanexit 1
fi
-# nested paging
-npaging="false"
-# enable VT
-enablevt="false"
-# check for VT, if not available use only 1 cpu (only 1 supported)
-[ ${vtflag} -eq 0 ] && cpu_cores=1
+npaging="false" # nested paging: Default: not enabled
+enablevt="false" # VT: Default: not enabled
+[ ${vtflag} -eq 0 ] && cpu_cores=1 # check for VT, if not available only 1 cpu supported
[ ${vtflag} -eq 1 ] && enablevt="true"
# set some base configuration depending on the guest operating system
@@ -173,19 +161,15 @@ writelog "\tMachine config:\t\t$machconfig"
macaddr=$(echo ${macaddr} | sed 's/://g')
vdemacaddr=$(echo ${macaddr} | sed 's/^..../00DE/g')
-# machine UUID, MAC addr part of it
-machineuuid="00000000-0000-0000-0000-${macaddr}"
-# cosmetical, since UUID in lower case
-machineuuid=$(echo ${machineuuid} | tr "[A-Z]" "[a-z]")
+machineuuid="00000000-0000-0000-0000-${macaddr}" # machine UUID, MAC addr part of it
+machineuuid=$(echo ${machineuuid} | tr "[A-Z]" "[a-z]") # cosmetical, since UUID in lower case
# get UUID of VBox image, if not diskless
[ ${diskless} -eq 0 ] && diskuuid=$(VBoxManage -q showvdiinfo ${diskfile} \
| grep UUID | grep -v "Parent UUID" | awk '{print $2}')
-# make disk immutable
-imgtype="Immutable"
-# snapshot UUID is static
-snapshotuuid="34f617be-192a-46b3-a8ae-bce1029e093f"
-# imageuuid in machine.include, dafault snapshotuuid
-imageuuid=${snapshotuuid}
+
+imgtype="Immutable" # make disk immutable
+snapshotuuid="34f617be-192a-46b3-a8ae-bce1029e093f" # snapshot UUID is static
+imageuuid=${snapshotuuid} # imageuuid in machine.include, default snapshotuuid
# check if rw image
# remove disk and add rwimg if set
@@ -202,13 +186,10 @@ if echo "${imgmode}" | grep -q rw; then
writelog "Please correct, exiting!"
cleanexit 1
fi
- # add lock
- touch "${vmpath}.lock"
- # remove lock after VM stopped
- RMDIRS="${RMDIRS} ${vmpath}.lock"
+ touch "${vmpath}.lock" # add lock
+ RMDIRS="${RMDIRS} ${vmpath}.lock" # remove lock after VM stopped
imgtype="Normal"
- # replace image uuid in machine config
- imageuuid=${diskuuid}
+ imageuuid=${diskuuid} # replace image uuid in machine config
elif [ ${diskless} -eq 0 ]; then
# use temp disk as snapshot
cat ${VMCHOOSERVBOX}/empty-diff.vdi.gz \
@@ -297,10 +278,8 @@ case ${boot} in
n*|tftp)
boot="Network"
if [ "${network_kind}" = "NAT" ] && [ -n "${virtualbox_tftpdir}" ]; then
- # use vm_shortname to avoid Problems /w TFTP in NAT
- vm_name=${vm_shortname}
- # link TFTP dir for NAT TFTP boots
- mkdir -p ${confdir}/TFTP
+ vm_name=${vm_shortname} # use vm_shortname to avoid Problems /w TFTP in NAT
+ mkdir -p ${confdir}/TFTP # link TFTP dir for NAT TFTP boots
if [ -e ${virtualbox_tftpdir}/pxelinux.0 ]; then
cp ${virtualbox_tftpdir}/pxelinux.0 ${confdir}/TFTP/${vm_name}.pxe
else
@@ -319,8 +298,7 @@ case ${boot} in
;;
esac
-# external GUI
-vrdpport=${remotedesktopport}
+vrdpport=${remotedesktopport} # external GUI
[ ${diskless} -eq 0 ] && writelog "\tSnapshots dir:\t\t$snapshotdir"
writelog "Diskimage:"
@@ -357,7 +335,7 @@ writelog "\tShared Folders '${sharename}':\t${sharepath}"
################################################################################
# create Virtualbox.xml
-. ${VMCHOOSERVBOX}/virtualbox.include
+. ${VMCHOOSERVBOX}/virtualbox.include # create Virtualbox.xml
# remove snapshot disk when using rw images
if [ "${imgtype}" != "Immutable" ]; then
@@ -367,8 +345,7 @@ fi
# TODO: add rawdisk if requested
#"raw.vmdk" format="VMDK" type="Writethrough"/>
-# create machine.xml
-. ${VMCHOOSERVBOX}/machine.include
+. ${VMCHOOSERVBOX}/machine.include # create machine.xml
# remove CD-ROM if not available
if [ "${cdrom0}" != "TRUE" ]; then