diff options
| author | Michael Janczyk | 2010-03-25 18:33:20 +0100 |
|---|---|---|
| committer | Michael Janczyk | 2010-03-25 18:33:20 +0100 |
| commit | 05d263fe3e313bde1c3da2fa67237df894971d43 (patch) | |
| tree | ce66520706d9b0c4362a308788d418bca62c139c /os-plugins/plugins/vmgrid | |
| parent | new run-virt.include for xen plugin. qemukvm modules now loaded via runlevels... (diff) | |
| download | core-05d263fe3e313bde1c3da2fa67237df894971d43.tar.gz core-05d263fe3e313bde1c3da2fa67237df894971d43.tar.xz core-05d263fe3e313bde1c3da2fa67237df894971d43.zip | |
added support for rw disks and netboot
Diffstat (limited to 'os-plugins/plugins/vmgrid')
| -rw-r--r-- | os-plugins/plugins/vmgrid/XX_vmgrid.sh | 31 | ||||
| -rw-r--r-- | os-plugins/plugins/vmgrid/files/run-vmgrid.sh | 26 |
2 files changed, 37 insertions, 20 deletions
diff --git a/os-plugins/plugins/vmgrid/XX_vmgrid.sh b/os-plugins/plugins/vmgrid/XX_vmgrid.sh index bdbd4836..39b8501a 100644 --- a/os-plugins/plugins/vmgrid/XX_vmgrid.sh +++ b/os-plugins/plugins/vmgrid/XX_vmgrid.sh @@ -18,9 +18,6 @@ # include functions . /etc/functions -# hostname? -host_name=${host_name:=$clientip} - CONFFILE="/initramfs/plugin-conf/vmgrid.conf" PLUGINCONFDIR=/mnt/${OPENSLX_DEFAULT_CONFDIR}/plugins/vmgrid VIRTUALIZATIONPLUGIN=/mnt/${OPENSLX_DEFAULT_CONFDIR}/plugins/virtualization @@ -30,7 +27,6 @@ RWSHAREMNT=/mnt/var/opt/openslx/mnt/vmgrid BINDIR=/mnt/${OPENSLX_DEFAULT_BINDIR} PLUGINDIR=${OPENSLX_DEFAULT_DIR}/plugin-repo/vmgrid VIRTDIR=/mnt/${OPENSLX_DEFAULT_VIRTDIR}/vmgrid -LOGDIR=/mnt/${OPENSLX_DEFAULT_LOGDIR} if [ -f $CONFFILE ]; then @@ -67,15 +63,16 @@ if [ -f $CONFFILE ]; then fi # create rw share - testmkd ${RWSHARE} + testmkd 1777 ${RWSHARE}/rwdir # bind mount id 45 to ${RWSHARE} if strinstr "id45" "${vmgrid_rwshare}" ; then id45part=$(grep " 45 " /etc/disk.partition | awk '{print $1}' | \ cut -f 3,3 -d /) if [ -n "${id45part}" ]; then - testmkd /mnt/media/${id45part}/vmgrid - mount --bind -n /mnt/media/${id45part}/vmgrid ${RWSHARE} \ - >>${LOGDIR}/vmgrid.log 2>&1 + # use rwdir because we want to use rwimg.vdi as well + testmkd /mnt/media/${id45part}/vmgrid/rwdir + mount --bind -n /mnt/media/${id45part}/vmgrid/rwdir ${RWSHARE}/rwdir \ + >>/tmp/vmgrid.log 2>&1 fi # mount nfs rw share elif strinstr "nfs://" "${vmgrid_rwshare}" ; then @@ -89,16 +86,22 @@ if [ -f $CONFFILE ]; then rwtarget=${RWSHAREMNT} # mount the vmgrid source rw fsmount ${rwshareprot} ${rwshareserv} ${rwsharepath} ${rwtarget} rw - testmkd ${RWSHAREMNT}/${host_name} - mount --bind ${RWSHAREMNT}/${host_name} ${RWSHARE} \ - >>${LOGDIR}/vmgrid.log 2>&1 + # hostname? + host_name=${host_name:=$clientip} + # use rwdir because we want to use rwimg.vdi as well + testmkd ${RWSHAREMNT}/${host_name}/rwdir + mount --bind ${RWSHAREMNT}/${host_name}/rwdir ${RWSHARE}/rwdir \ + >>/tmp/vmgrid.log 2>&1 fi else - testmkd /mnt/tmp/vmgrid - mount --bind -n /mnt/tmp/vmgrid ${RWSHARE} >>${LOGDIR}/vmgrid.log 2>&1 + # use rwdir because we want to use rwimg.vdi as well + testmkd 1777 /mnt/tmp/vmgrid/rwdir + mount --bind -n /mnt/tmp/vmgrid/rwdir ${RWSHARE}/rwdir \ + >>/tmp/vmgrid.log 2>&1 fi # chmod so that everybody can write - chmod 1777 ${RWSHARE} + chmod -R 1777 ${RWSHARE} + echo "vmgrid_rwdir=${RWSHARE#/mnt}" >> ${PLUGINCONFDIR}/vmgrid.conf # TODO: virtual virtualization plugin diff --git a/os-plugins/plugins/vmgrid/files/run-vmgrid.sh b/os-plugins/plugins/vmgrid/files/run-vmgrid.sh index ce707830..ac1dd8fd 100644 --- a/os-plugins/plugins/vmgrid/files/run-vmgrid.sh +++ b/os-plugins/plugins/vmgrid/files/run-vmgrid.sh @@ -130,8 +130,8 @@ EOL writelog "Starting configuration..." writelog "\tVM-ID:\t\t\t${VM_ID}" writelog "\tLogfile:\t\t${OPENSLX_DEFAULT_LOGDIR}/run-vmgrid.${USER}.$$.log" -writelog "\t$(df -h | grep " /tmp$" | awk '{print $2}') \c" -writelog "\t/tmp info:\t\t$(grep "/tmp " /proc/mounts) $(df -h | \ +writelog "\t/tmp info:\t\t$(df -h | grep " /tmp$" | awk '{print $2}') \c" +writelog " $(grep "/tmp " /proc/mounts) $(df -h | \ grep " /tmp$" | awk '{print $2}')" writelog "\tVM XML dir:\t\t${vmgrid_xmlpath}" writelog "\tVM Image dir:\t\t${vmgrid_imgpath}" @@ -148,7 +148,17 @@ writelog "VM config:" # name of the virt image or dir imgname=$(grep -io '<image_name param=.*"' ${xmlfile} | \ sed -e "s/&.*;/; /g" | awk -F '"' '{ print $2 }') -if echo ${imgname} 2>/dev/null | grep '/' >/dev/null 2>&1; then + +# image mode +imgmode=$(grep -io '<image_mode param=.*"' ${xmlfile} | \ + sed -e "s/&.*;/; /g" | awk -F '"' '{ print $2 }') + +if [ "${imgmode}" = "rwimg" ]; then + # maybe you want to support the users /w an ampty rw imgae? + imgname="rwimg" + # add new path for rwimg + imgpath=${vmgrid_rwdir} +elif echo ${imgname} 2>/dev/null | grep '/' >/dev/null 2>&1; then imgpath=$(dirname ${imgname}) imgname=$(basename ${imgname}) else @@ -157,8 +167,8 @@ fi # set default v path vmpath=${imgpath}/${imgname} -# check if virtual machine container file exists -if ! [ -e $vmpath ]; then +# check if virtual machine container file exists, only if not rwimg +if ! [ -e $vmpath ] && ! [ "${imgmode}" = "rwimg" ]; then writelog "\tVirtual machine image or directory ${vmpath} not found!" exit 1 fi @@ -236,6 +246,9 @@ network_kind=$(grep -io 'network param=.*"' ${xmlfile} | \ network_card=$(grep -io 'netcard param=.*"' ${xmlfile} | \ awk -F '"' '{ print $2 }') +# get boot attr +boot=$(grep -io 'boot param=.*"' ${xmlfile} | awk -F '"' '{ print $2 }') + writelog "\tVirtualization:\t\t$xmlvirt" writelog "\tVM name:\t\t$vm_name" writelog "\tVM short name:\t\t$vm_shortname" @@ -276,7 +289,8 @@ scsi="FALSE" hddrv="ide" # add rw share -rwshare="/var/opt/openslx/plugins/vmgrid/share" +sharepath="${vmgrid_rwdir}/rwdir" +sharename="share" # set hostname: using original hostname and adding string hostname="vmgrid${VM_ID}-$(hostname)" |
