From 6fef481e06b5249340e0c9282c6edad222312474 Mon Sep 17 00:00:00 2001 From: Dirk Date: Thu, 30 Jun 2011 00:26:20 +0200 Subject: ... --- src/os-plugins/plugins/vmchooser/XX_vmchooser.sh | 2 + src/os-plugins/plugins/vmchooser/files/run-virt.sh | 66 +++++++++++----------- 2 files changed, 34 insertions(+), 34 deletions(-) (limited to 'src/os-plugins/plugins/vmchooser') 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 '/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 '/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 '/dev/null| grep -ve "^$") xres=$(echo "${hostres}" | awk '{print $3}') yres=$(echo "${hostres}" | awk '{print $7}') -# enable 3D +# Enable 3D enable3d=$(grep -i "/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 -- cgit v1.2.3-55-g7522