summaryrefslogtreecommitdiffstats
path: root/os-plugins/plugins/qemukvm/files/run-virt.include
diff options
context:
space:
mode:
authorMichael Janczyk2010-03-22 23:50:43 +0100
committerMichael Janczyk2010-03-22 23:50:43 +0100
commitd50ca9e27cfb7fd8aba92ec557eb07944f3a33ad (patch)
tree08617623a0ef1c7c7d6828d6a4034fbd298c1567 /os-plugins/plugins/qemukvm/files/run-virt.include
parentsmall bugfix regarding xmlfile and paths. (diff)
downloadcore-d50ca9e27cfb7fd8aba92ec557eb07944f3a33ad.tar.gz
core-d50ca9e27cfb7fd8aba92ec557eb07944f3a33ad.tar.xz
core-d50ca9e27cfb7fd8aba92ec557eb07944f3a33ad.zip
qemukvm weiter, sollte laufen (ungetestet), noch anpassungen an scripten notwendig (XX_qemu.., ifup), sudoers, /dev/fb0 für jedermann zugreifbar
Diffstat (limited to 'os-plugins/plugins/qemukvm/files/run-virt.include')
-rw-r--r--os-plugins/plugins/qemukvm/files/run-virt.include50
1 files changed, 28 insertions, 22 deletions
diff --git a/os-plugins/plugins/qemukvm/files/run-virt.include b/os-plugins/plugins/qemukvm/files/run-virt.include
index 0cec83da..bdf9666f 100644
--- a/os-plugins/plugins/qemukvm/files/run-virt.include
+++ b/os-plugins/plugins/qemukvm/files/run-virt.include
@@ -31,7 +31,8 @@ fi
### Declaration of default variables
################################################################################
-PLUGINCONFVIRTUALBOX="${PLUGINCONFROOT}/${self}"
+PLUGINCONFQK="${PLUGINCONFROOT}/${self}"
+PLUGINDIRQK=${OPENSLX_DEFAULT_DIR}/plugin-repo/${self}
# create TMPDIR for all users
mkdir -m 1777 /tmp/${self} 2>/dev/null
# TMPDIR
@@ -51,11 +52,12 @@ else
exit 1
fi
-# display name
+# display name, remove blanks because of cmdline problems
+displayname=$(echo ${displayname} | sed -e "s, ,-,g")
VIRTCMDOPTS="${VIRTCMDOPTS} -name ${displayname}"
writelog "Directories:"
-writelog "\tTMPDIR:\t\t$QKTMPDIR"
+writelog "\tTMPDIR:\t\t\t$QKTMPDIR"
writelog "Diskimage:"
writelog "\tDisk type:\t\t$imgtype"
writelog "\tDisk file:\t\t$diskfile"
@@ -112,16 +114,21 @@ VIRTCMDOPTS="${VIRTCMDOPTS} -m ${mem}"
network_card=${network_card:=pcnet}
VIRTCMDOPTS="${VIRTCMDOPTS} -net nic,model=${network_card}"
+# define net kind and apply script
+qemu_ifscripts="script=${PLUGINDIRQK}/ifup,downscript=${PLUGINDIRQK}/ifdown"
case "${network_kind}" in
bridge*)
- VIRTCMDOPTS="${VIRTCMDOPTS} -net tap,ifname=tap0"
+ VIRTCMDOPTS="${VIRTCMDOPTS} -net tap,ifname=tap0,${qemu_ifscripts}"
+ ;;
+ NAT|nat)
+ VIRTCMDOPTS="${VIRTCMDOPTS} -net tap,ifname=tap1,${qemu_ifscripts}"
;;
hostonly|host-only)
- VIRTCMDOPTS="${VIRTCMDOPTS} -net tap,ifname=tap2"
+ VIRTCMDOPTS="${VIRTCMDOPTS} -net tap,ifname=tap2,${qemu_ifscripts}"
;;
*)
- network_kind="NAT"
- VIRTCMDOPTS="${VIRTCMDOPTS} -net tap,ifname=tap1"
+ network_kind="user"
+ VIRTCMDOPTS="${VIRTCMDOPTS} -net user"
;;
esac
@@ -226,40 +233,39 @@ writelog "\tNetwork kind:\t\t${network_kind}"
#-show-cursor show cursor
# check for kvm modules
-# TODO: check for /dev/kvm
if [ -n "${kvm}" ]; then
- if lsmod |Êgrep ${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
- writelog "KVM available but no modules loaded, maybe compiled into kernel?"
VIRTCMD=$(which qemu 2>/dev/null)
+ writelog "KVM available but /dev/kvm not found!"
+ writelog "Trying fallback to QEMU emulation."
fi
fi
-# set the variables appropriately
-#for tool in kvm qemu-kvm qemu; do
-# VIRTCMD=$(which ${tool} 2>/dev/null)
-# [ -n "$VIRTCMD" ] && break
-#done
-
if [ -z "${VIRTCMD}" ]; then
- writelog "No QEMU/KVM found."
+ writelog "No QEMU/KVM found, exiting!"
rm -rf ${RMDIRS}
exit 1
-elif [ "${VIRTCMD}" = "qemu" ]; then
- writelog "No KVM fouund. Starting slow QEMU emulation"
- VIRTCMD="qemu"
+elif [ "${VIRTCMD##*/}" = "qemu" ]; then
+ writelog "No user space KVM found. Using slow QEMU emulation"
+ writelog "User space emulation:\t\t${VIRTCMD}"
else
+ writelog "User space virtualization:\t${VIRTCMD}"
VIRTCMD="sudo $VIRTCMD"
fi
+# TODO: boot als var, -boot n, tftp...
+VIRTCMDOPTS="${VIRTCMDOPTS} -boot c"
+
# set headless mode
+# define first, you do not want VIRTCMDOPTS from graphical start
VIRTCMDHL="$VIRTCMD"
-VIRTCMDOPTSHL="${VIRTCMDOPTS} -boot c -alt-grab -nographic"
+VIRTCMDOPTSHL="${VIRTCMDOPTS} -alt-grab -nographic -snapshot ${diskfile}"
# graphical start
VIRTCMD="$VIRTCMD"
-VIRTCMDOPTS="${VIRTCMDOPTS} -boot c -alt-grab -full-screen ${diskfile}"
+VIRTCMDOPTS="${VIRTCMDOPTS} -alt-grab -full-screen -snapshot ${diskfile}"