summaryrefslogtreecommitdiffstats
path: root/src/os-plugins/plugins/vmchooser
diff options
context:
space:
mode:
authorDirk2011-06-30 00:26:20 +0200
committerDirk2011-06-30 00:26:20 +0200
commit6fef481e06b5249340e0c9282c6edad222312474 (patch)
tree52d8fe1c3aac6ffc8a047201f1b59ccbf99017b9 /src/os-plugins/plugins/vmchooser
parentFixes for SuSE ... (diff)
downloadcore-6fef481e06b5249340e0c9282c6edad222312474.tar.gz
core-6fef481e06b5249340e0c9282c6edad222312474.tar.xz
core-6fef481e06b5249340e0c9282c6edad222312474.zip
...
Diffstat (limited to 'src/os-plugins/plugins/vmchooser')
-rw-r--r--src/os-plugins/plugins/vmchooser/XX_vmchooser.sh2
-rw-r--r--src/os-plugins/plugins/vmchooser/files/run-virt.sh66
2 files changed, 34 insertions, 34 deletions
diff --git a/src/os-plugins/plugins/vmchooser/XX_vmchooser.sh b/src/os-plugins/plugins/vmchooser/XX_vmchooser.sh
index 2428622e..cd6d54e5 100644
--- a/src/os-plugins/plugins/vmchooser/XX_vmchooser.sh
+++ b/src/os-plugins/plugins/vmchooser/XX_vmchooser.sh
@@ -77,10 +77,12 @@ if [ -e $CONFFILE ]; then
testmkd /mnt/tmp/virt
# enable normal users to setup the extended virtual machine redo file space
+ # and image source via network block device (NBD only at the moment)
cat >> /mnt/etc/sudoers << EOF
# allow to start and stop the special /tmp redo file space (RAM + NBD/NFS server RAID)
ALL ALL=NOPASSWD: /sbin/losetup /dev/loop*
ALL ALL=NOPASSWD: /sbin/mdadm -C /dev/md0 -l linear --raid-devices=2 /dev/loop* /dev/*
+ALL ALL=NOPASSWD: /opt/openslx/rootfs/usr/sbin/nbd-client * * /dev/nbd*
EOF
# finished ...
diff --git a/src/os-plugins/plugins/vmchooser/files/run-virt.sh b/src/os-plugins/plugins/vmchooser/files/run-virt.sh
index 137012a3..37db0c23 100644
--- a/src/os-plugins/plugins/vmchooser/files/run-virt.sh
+++ b/src/os-plugins/plugins/vmchooser/files/run-virt.sh
@@ -57,7 +57,7 @@ cleanexit () {
exit "$1"
}
-# Check for important files used
+# check for important files used
filecheck ()
{
filecheck=$(LANG=us ls -lh ${diskfile} 2>&1)
@@ -65,7 +65,7 @@ filecheck ()
noimage=$(echo ${filecheck} | grep -i "no such file or directory" | wc -l)
rightsfile=${diskfile}
- # Check if link
+ # check if link
if [ -L "${diskfile}" ]; then
# take link target
rightsfile=$(ls -lh ${diskfile} 2>&1 | awk -F '-> *' '{print $2}')
@@ -73,7 +73,7 @@ filecheck ()
filecheck=$(LANG=us ls -lh ${rightsfile} 2>&1)
fi
- # Does file exist
+ # does file exist
if [ "${noimage}" -ge "1" ]; then
writelog "Virtual Machine Image Problem:\c "
writelog "\tThe image you've specified doesn't exist."
@@ -84,7 +84,7 @@ filecheck ()
exit 1
fi
- # Readable by calling user
+ # readable by calling user
if ! [ -r "${diskfile}" >/dev/null 2>&1 \
-o -r "${diskfile}" >/dev/null 2>&1 ]; then
writelog "Vmware Image Problem:\c "
@@ -95,7 +95,7 @@ filecheck ()
exit 1
fi
- # Writable (for persistent-mode)?
+ # writable (for persistent-mode)?
if ! [ -w "${diskfile}" >/dev/null 2>&1 \
-o -w "${diskfile}" >/dev/null 2>&1 ] \
&& [ "${np}" = "independent-persistent" ]; then
@@ -133,7 +133,7 @@ if ! [ -r "${xmlfile}" ]; then
exit 1
fi
-# test if XML file
+# Test if XML file
if ! grep '<?xml' "${xmlfile}" >/dev/null 2>&1; then
writelog \
"Submitted configuration file ${xmlfile} seems to have wrong XML format"
@@ -169,49 +169,49 @@ writelog "\tVM XML dir:\t\t$(dirname ${xmlfile})"
writelog "\tXML file:\t\t${xmlfile}"
writelog "VM config:"
-# name of the virt image
+# Name of the virt image
imgname=$(grep -io '<image_name param=.*"' ${xmlfile} \
| sed -e "s/&.*;/; /g" | awk -F '"' '{ print $2 }')
-# imagename /w full path
+# Imagename /w full path
if echo ${imgname} 2>/dev/null | grep -q '^/' >/dev/null 2>&1; then
imgpath=$(dirname ${imgname})
imgname=$(basename ${imgname})
vmpath=${imgpath}/${imgname}
-# if old vmchooser binary stuff
-# we do not need folder name as it is already included by vmchooser
+# If old vmchooser binary stuff
+# We do not need folder name as it is already included by vmchooser
elif echo ${xmlfile} 2>/dev/null | grep -q '^/tmp/' >/dev/null 2>&1; then
vmpath=$imgname
imgname=$(basename ${imgname})
-# else use same path as xml
+# Else use same path as xml
else
imgpath=${xmlpath}
vmpath=${imgpath}/${imgname}
fi
-# check if virtual machine container file exists
+# Check if virtual machine container file exists
if ! [ -e "${vmpath}" ]; then
writelog "Virtual machine image ${vmpath} not found!"
exit 1
fi
-# name of the virt machine, sed because of Windows formatting
+# Name of the virt machine, sed because of Windows formatting
vm_name=$(grep -o 'short_description param=.*"' ${xmlfile} \
| sed -e "s/&.*;/; /g" | awk -F '"' '{print $2}')
-# if ${vm_name} not defined use ${xmlfile}
+# If ${vm_name} not defined use ${xmlfile}
vm_name=${vm_name:-${xmlfile%.xml}}
-# define vm_shortname since vm_name can be very long
+# Define vm_shortname since vm_name can be very long
vm_shortname=$(basename ${xmlfile%.xml} | sed -e "s, ,-,g")
# vm_name = displayname, define for old scripts
displayname=${vm_name}
-# image is for the following virtual machine
+# Image is for the following virtual machine
xmlvirt=$(grep -o 'virtualmachine param=.*"' ${xmlfile} \
| sed -e "s/&.*;/; /g" | awk -F '"' '{print $2}')
-# make a guess from the filename extension if ${xmlvirt} is empty
+# Make a guess from the filename extension if ${xmlvirt} is empty
# (not set within the XML file)
# TODO: implement possibility to submit own configuration files
if [ -z "${xmlvirt}" ] && [ -n "${additional_config}" ]; then
@@ -249,17 +249,17 @@ elif [ -z "${xmlvirt}" ]; then
writelog "result:\t${xmlvirt}"
fi
-# definition of the client system
+# Definition of the client system
vmostype=$(grep -io '<os param=.*"' ${xmlfile} | awk -F '"' '{ print $2 }' \
| tr "[A-Z]" "[a-z]")
-# definition of the networking the client system is connected to
+# Definition of the networking the client system is connected to
network_kind=$(grep -io '<network param=.*"' ${xmlfile} \
| awk -F '"' '{ print $2 }' | tr "[A-Z]" "[a-z]")
network_card=$(grep -io '<netcard param=.*"' ${xmlfile} \
| awk -F '"' '{ print $2 }'| tr "[A-Z]" "[a-z]")
-# set redirects to 0, see vmgrid if you want to define some
+# Set redirects to 0, see vmgrid if you want to define some
redirects=0
# Serial/parallel ports defined (e.g. "ttyS0" or "autodetect")
@@ -279,12 +279,13 @@ writelog "\tVM short name:\t\t$vm_shortname"
# VM-ID static (00)
VM_ID="00"
-# make sure cpu_cores is not empty
+# Make sure cpu_cores is not empty
cpu_cores=${cpu_cores:-"1"}
-# total amount of memory defined in stage 3
+# Total amount of memory defined in stage 3
+# TODO: Should be dependent on the setup (if diff is written to RAM ...)
permem=60
-# get a result which can be divided through 4
+# Get a result which can be divided through 4
mem=$(expr ${totalmem} / 100 \* ${permem} / 4 \* 4)
if [ -n "${mainvirtmem}" ]; then
forcemem=$(expr ${mainvirtmem} / 4 \* 4)
@@ -292,7 +293,7 @@ if [ -n "${mainvirtmem}" ]; then
fi
hostmem=$(expr ${totalmem} - ${mem})
-# configuring ethernet mac address: first 3 bytes are fixed (00:50:56)
+# Configuring ethernet mac address: first 3 bytes are fixed (00:50:56)
# 4th byte is the VM-ID (0D)
# last two bytes are taken from the bridge of the host
# define one MAC per guest
@@ -300,7 +301,7 @@ macguestpart="00:50:56:${VM_ID}"
machostpart=$(echo ${hostmacaddr} | awk -F ":" '{print $(NF-1)":"$NF}')
macaddr=$(echo "${macguestpart}:${machostpart}" | tr "[a-z]" "[A-Z]")
-# virtual fd/cd/dvd and drive devices, floppy b: for configuration
+# Virtual fd/cd/dvd and drive devices, floppy b: for configuration
# if $floppy_0 from run-virt.include set then fdtest="TRUE"
fdtest=
fdtest=${floppy_0:+"TRUE"}
@@ -318,7 +319,7 @@ cdtest=
cdtest=${cdrom_1:+"TRUE"}
# if $cdtest not set cdrom1="FALSE", else "TRUE"
cdrom1=${cdtest:-"FALSE"}
-# ide is expected default, test for the virtual disk image type should
+# IDE is expected default, test for the virtual disk image type should
# be done while creating the runscripts ...
ide="TRUE"
scsi="FALSE"
@@ -331,15 +332,15 @@ hostres=$(xvidtune -show 2>/dev/null| grep -ve "^$")
xres=$(echo "${hostres}" | awk '{print $3}')
yres=$(echo "${hostres}" | awk '{print $7}')
-# enable 3D
+# Enable 3D
enable3d=$(grep -i "<enable3d param=.*" ${xmlfile} 2>/dev/null | \
awk -F '=' {'print $2'})
-# add rw share
+# Add rw share
sharepath="${HOME}"
sharename="home"
-# set hostname: using original hostname and adding string
+# Set hostname: using original hostname and adding string
hostname="virt-$(hostname)"
writelog "\tVM Hostname:\t\t$hostname"
@@ -365,9 +366,6 @@ writelog "finished\n"
#echo "Please fix the config.xml generation"
cp ${xmlfile} ${PLUGINCONFDIR}/fd-loop/config.xml
-# Check if virtual machine container file exists
-#filecheck
-
# Get all virtual machine specific stuff from the respective include file
if [ -e ${PLUGINCONFROOT}/${xmlvirt}/run-virt.include ] ; then
self=${xmlvirt}
@@ -385,7 +383,7 @@ if [ -e ${PLUGINCONFROOT}/${xmlvirt}/run-virt.include ] ; then
break
fi
done
- # start poolvideoswitch if we find the autostarter file
+ # Start poolvideoswitch if we find the autostarter file
if [ -e /etc/xdg/autostart/pvsgui.desktop ]; then
/usr/local/bin/pvsgui -p 2 -b >/dev/null 2>&1 &
fi
@@ -397,7 +395,7 @@ else
cleanexit 1
fi
-# postrun for scripts after virtualization finishes
+# Postrun for scripts after virtualization finishes
if [ -n "${POSTRUN}" ]; then
eval ${POSTRUN} >/dev/null 2>&1
fi