summaryrefslogtreecommitdiffstats
path: root/os-plugins/plugins/virtualbox/files/run-virt.include
diff options
context:
space:
mode:
authorMichael Janczyk2010-04-08 21:07:44 +0200
committerMichael Janczyk2010-04-08 21:07:44 +0200
commit8ac3d72cd1ba2d9b76f6c201b6cb9f3389915cb6 (patch)
tree96242f130329608c1d97bec48576c802208635ed /os-plugins/plugins/virtualbox/files/run-virt.include
parentMerge branch 'master' into vmgrid (diff)
downloadcore-8ac3d72cd1ba2d9b76f6c201b6cb9f3389915cb6.tar.gz
core-8ac3d72cd1ba2d9b76f6c201b6cb9f3389915cb6.tar.xz
core-8ac3d72cd1ba2d9b76f6c201b6cb9f3389915cb6.zip
virtualization plugin refurbished ;). booting 64bit guest on 32 bit hosts now possible /w virtualbox
Diffstat (limited to 'os-plugins/plugins/virtualbox/files/run-virt.include')
-rw-r--r--os-plugins/plugins/virtualbox/files/run-virt.include44
1 files changed, 34 insertions, 10 deletions
diff --git a/os-plugins/plugins/virtualbox/files/run-virt.include b/os-plugins/plugins/virtualbox/files/run-virt.include
index 5fc0641a..af5595ee 100644
--- a/os-plugins/plugins/virtualbox/files/run-virt.include
+++ b/os-plugins/plugins/virtualbox/files/run-virt.include
@@ -66,7 +66,7 @@ diskfile="${diskfolder}/${imgname}"
[ ${diskless} -eq 0 ] && ln -sf ${vmpath} ${diskfile}
# check the file type
-if echo ${imgname} | grep -iE "vdi|vmdk|vhd" && [ ${diskless} -eq 0 ]; then
+if echo ${imgname} | grep -qiE "vdi|vmdk|vhd" && [ ${diskless} -eq 0 ]; then
imgfmt=$(echo ${imgname##*.} | tr [a-z] [A-Z])
elif [ ${diskless} -eq 0 ]; then
writelog "${imgname} is not a valid image format (vdi|vmdk|vhd), exiting!"
@@ -76,17 +76,31 @@ fi
# TODO: maybe rewrite, to reduce checks, merge it with network option,
# so we can have a "compatibility to vmware config" section
case "${vmostype}" in
- winxp*)
+ winxp*|windowsxp*)
vmostype="WindowsXP"
;;
- winvista*)
+ winvista*|windowsvista*)
vmostype="WindowsVista"
;;
- Windows7*)
+ windows7*)
vmostype="Windows7"
;;
- linux*)
- vmostype="Linux26"
+ linux*|*ubuntu*|*suse*|debian*|*sci*)
+ if echo "${vmostype}" | grep -q "64"; then
+ vmostype="Linux26_64"
+ # check for vtflag
+ if [ ${vtflag} -ne 1 ]; then
+ writelog "You are trying to boot a 64 bit OS without a VT enabled CPU"
+ writelog "This is not supported, exiting!"
+ exit 1
+ fi
+ # check if host is only 32 bit, then use only 1 cpu (only 1 supported)
+ if echo "${host_arch}" | grep -qE "i.86"; then
+ cpu_cores=1
+ fi
+ else
+ vmostype="Linux26"
+ fi
;;
esac
@@ -123,7 +137,7 @@ if echo "${imgmode}" | grep -q rw; then
# lock existing?
if [ -e "${vmpath}.lock" ]; then
writelog "This rw image is already in use: ${vmpath}, exiting!"
- writelog "Remove lock if you are shure that this is not the case"
+ writelog "Remove lock if you are sure that this is not the case"
exit 1
# image rw?
elif ! [ -w ${vmpath} ]; then
@@ -144,6 +158,9 @@ elif [ ${diskless} -eq 0 ]; then
| gunzip > "${snapshotdir}/{${snapshotuuid}}.vdi"
fi
+# make sure cpu_cores is not empty
+cpu_cores=${cpu_cores:-"1"}
+
# TODO: MEM muss noch angepasst werden. Maschine crasht wenn nehr als 50% MEM
# memory part equal to vmware plugin
# percentage of memory to use for virtualbox in standard case
@@ -222,7 +239,13 @@ case ${boot} in
vm_name=$(echo ${vm_name} | sed -e "s, ,-,g")
# link TFTP dir for NAT TFTP boots
mkdir -p ${confdir}/TFTP
- cp ${virtualbox_tftpdir}/pxelinux.0 ${confdir}/TFTP/${vm_name}.pxe
+ if [ -e ${virtualbox_tftpdir}/pxelinux.0 ]; then
+ cp ${virtualbox_tftpdir}/pxelinux.0 ${confdir}/TFTP/${vm_name}.pxe
+ else
+ writelog "${virtualbox_tftpdir}/pxelinux.0 not found!"
+ writelog "Network boot won't work, exiting!"
+ exit 1
+ fi
for i in $(ls ${virtualbox_tftpdir}); do
ln -sf ${virtualbox_tftpdir}/${i} ${confdir}/TFTP/${i}
done
@@ -271,6 +294,7 @@ writelog "Diskimage:"
writelog "\tMachine UUID:\t\t$machineuuid"
[ ${diskless} -eq 0 ] && writelog "\tDisk UUID:\t\t$diskuuid"
writelog "Virtual Hardware:"
+[ ${vtflag} -eq 1 ] && writelog "\tVT enabled CPU"
writelog "\tGuest RAM:\t\t${mem} MB"
# echo nur wenn memhost gesetzt
[ -n "${memhost}" ] && writelog "\tHost RAM:\t\t${memhost} MB"
@@ -315,8 +339,8 @@ if [ ${diskless} -eq 1 ]; then
sed -i "/<!-- PLEASE DO NOT REMOVE THIS COMMENT!!! -->/d" ${machconfig}
fi
-# add ssh port if linux and NAT
-if [ "${vmostype}" = "Linux26" ] && [ "${network_kind}" = "NAT" ]; then
+# add ssh port if Linux26* and NAT
+if echo "${vmostype}" | grep -q "Linux26" && [ "${network_kind}" = "NAT" ]; then
vmsshport="220${VM_ID}"
extradataitem='<ExtraDataItem name="VBoxInternal/Devices' \
extradataitem="${extradataitem}/${network_card}/0/LUN#0/Config/ssh/"