Support different virtualization technologies for run-qemu.

If the host supports kvm, use is. If this is not the case but the kqemu
module is loaded, run qemu with kqemu optimization. Otherwise fall-back to
pure usermode qemu.
master
Andreas Thienemann 2009-05-21 12:24:58 +02:00 committed by Harald Hoyer
parent 4957ab92f2
commit 8a4b60d9b2
1 changed files with 16 additions and 8 deletions

View File

@ -1,9 +1,17 @@
#!/bin/bash #!/bin/bash
for f in kvm qemu-kvm qemu; do
type $f >/dev/null 2>&1 || continue # Check which virtualization technology to use
$f "$@" # We prefer kvm, kqemu, userspace in that order.
exit [[ -x /usr/bin/qemu ]] && BIN=/usr/bin/qemu && ARGS=""
done $(lsmod | grep -q '^kqemu ') && BIN=/usr/bin/qemu && ARGS="-kernel-kqemu "
echo "Could not find a working KVM or QEMU to test with!" [[ -b /dev/kvm && -x /usr/bin/kvm ]] && BIN=/usr/bin/kvm && ARGS=""
echo "Please install kvm or qemu." [[ -b /dev/kvm && -x /usr/bin/qemu-kvm ]] && BIN=/usr/bin/qemu-kvm && ARGS=""

[[ $BIN ]] || {
echo "Could not find a working KVM or QEMU to test with!" >&2
echo "Please install kvm or qemu." >&2
exit 1 exit 1
}

echo "Running $BIN $ARGS"
$BIN $ARGS "$@"