diff options
Diffstat (limited to 'os-plugins/plugins/virtualbox/files/run-virt.include')
-rw-r--r-- | os-plugins/plugins/virtualbox/files/run-virt.include | 71 |
1 files changed, 39 insertions, 32 deletions
diff --git a/os-plugins/plugins/virtualbox/files/run-virt.include b/os-plugins/plugins/virtualbox/files/run-virt.include index f904b5f2..abf1e0be 100644 --- a/os-plugins/plugins/virtualbox/files/run-virt.include +++ b/os-plugins/plugins/virtualbox/files/run-virt.include @@ -185,16 +185,21 @@ else fi # translate network cards -if [ "${network_card}" = "e1000" ]; then - vb_network_card="82540EM" -else - network_card="pcnet" - vb_network_card="Am79C973" -fi +case "${network_card}" in + e1000) + vb_network_card="82540EM" + ;; + virtio) + vb_network_card="virtio" + ;; + *) + network_card="pcnet" + vb_network_card="Am79C973" +esac # translate network kinds (nat, bridged, host-only) case "${network_kind}" in - bridged) + bridge*) network_kind='BridgedInterface name="br0"' ;; hostonly|host-only) @@ -204,6 +209,33 @@ case "${network_kind}" in network_kind="NAT" esac +# translate boot, use if set else set to HardDisk +# usually support for a,c,d,n, stands for Floppy, HD, CD-ROM, Network +# support nfs and tftp as well +if [ -n "${boot}" ]; then + case ${boot} in + n*|tftp) + boot="Network" + if [ "${network_kind}" = "NAT" ] && [ -n "${virtualbox_tftpdir}" ]; then + # remove spaces from VM name to avoid Problems /w TFTP in NAT + 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 + for i in $(ls ${virtualbox_tftpdir}); do + ln -sf ${virtualbox_tftpdir}/${i} ${confdir}/TFTP/${i} + done + fi + ;; + # later maybe c|disk|hd*|sd*) for HD and d|cd*) for CD-ROM + *) + boot="HardDisk" + ;; + esac +else + boot="HardDisk" +fi + # external GUI vrdpport="590${VM_ID}" @@ -232,31 +264,6 @@ cdrom1=${cdtest:-"FALSE"} ide="TRUE" hddrv="ide" -# translate boot, use if set else set to HardDisk -if [ -n "${boot}" ]; then - case ${boot} in - n*) # usually support for a,c,d,n, stands for Floppy, HD, CD-ROM, Network - boot="Network" - if [ "${network_kind}" = "NAT" ] && [ -n "${virtualbox_tftpdir}" ]; then - # remove spaces from VM name to avoid Problems /w TFTP in NAT - 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 - for i in $(ls ${virtualbox_tftpdir}); do - ln -sf ${virtualbox_tftpdir}/${i} ${confdir}/TFTP/${i} - done - fi - ;; - # later maybe c|disk|hd*|sd*) for HD and d|cd*) for CD-ROM - *) - boot="HardDisk" - ;; - esac -else - boot="HardDisk" -fi - [ ${diskless} -eq 0 ] && writelog "\tSnapshots dir:\t\t$snapshotdir" writelog "Diskimage:" [ ${diskless} -eq 0 ] && writelog "\tDisk file:\t\t$diskfile" |