summaryrefslogtreecommitdiffstats
path: root/os-plugins/plugins/qemukvm
diff options
context:
space:
mode:
Diffstat (limited to 'os-plugins/plugins/qemukvm')
-rw-r--r--os-plugins/plugins/qemukvm/files/run-virt.include43
1 files changed, 30 insertions, 13 deletions
diff --git a/os-plugins/plugins/qemukvm/files/run-virt.include b/os-plugins/plugins/qemukvm/files/run-virt.include
index 84e534e8..7db2bfc9 100644
--- a/os-plugins/plugins/qemukvm/files/run-virt.include
+++ b/os-plugins/plugins/qemukvm/files/run-virt.include
@@ -46,7 +46,7 @@ diskfile=${vmpath}
# check the file type
if echo ${imgname} | grep -iE "img|qcow|vmdk" >/dev/null 2>&1; then
- imgtype=$(echo ${imgname#*.} | tr [a-z] [A-Z])
+ imgtype=$(echo ${imgname##*.} | tr [a-z] [A-Z])
else
writelog "${imgname} is not a valid image type (img|qcow*|vmdk), exiting!"
exit 1
@@ -115,7 +115,7 @@ VIRTCMDOPTS="${VIRTCMDOPTS} -m ${mem}"
# network adaptor alternatives: rtl8139, pcnet, e1000
network_card=${network_card:=pcnet}
-VIRTCMDOPTS="${VIRTCMDOPTS} -net nic,model=${network_card}"
+VIRTCMDOPTS="${VIRTCMDOPTS} -net nic,macaddr=${macaddr},model=${network_card}"
# define net kind and apply script
qemu_ifscripts="script=${PLUGINDIRQK}/ifup,downscript=${PLUGINDIRQK}/ifdown"
@@ -135,6 +135,25 @@ case "${network_kind}" in
;;
esac
+# 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="n"
+ # TODO: does not work yet, can be removed if tap1 solution better
+ if [ "${network_kind}" = "user" ] && [ -n "${virtualbox_tftpdir}" ]; then
+ VIRTCMDOPTS="${VIRTCMDOPTS},tftp=${virtualbox_tftpdir}"
+ fi
+ ;;
+ # later maybe c|disk|hd*|sd*) for HD and d|cd*) for CD-ROM
+ *)
+ boot="c"
+ ;;
+ esac
+else
+ boot="c"
+fi
+
# external GUI port
vncport="590${VM_ID}"
@@ -237,17 +256,15 @@ writelog "\tNetwork kind:\t\t${network_kind}"
#-show-cursor show cursor
# check for kvm modules
-if [ -n "${kvm}" ]; then
- if [ -e /dev/kvm ]; then
- for tool in kvm qemu-kvm; do
- VIRTCMD=$(which ${tool} 2>/dev/null)
- [ -n "$VIRTCMD" ] && break
- done
- else
- VIRTCMD=$(which qemu 2>/dev/null)
- writelog "KVM available but /dev/kvm not found!"
- writelog "Trying fallback to QEMU emulation."
- fi
+if [ -c /dev/kvm ]; then
+ for tool in kvm qemu-kvm; do
+ VIRTCMD=$(which ${tool} 2>/dev/null)
+ [ -n "$VIRTCMD" ] && break
+ done
+else
+ VIRTCMD=$(which qemu 2>/dev/null)
+ writelog "KVM available but /dev/kvm not found!"
+ writelog "Trying fallback to QEMU emulation."
fi
if [ -z "${VIRTCMD}" ]; then