1
0
Fork 0
mirror of https://passt.top/passt synced 2025-06-01 22:05:43 +02:00

Invoke specific qemu-system-* binaries

A lot of tests and examples invoke qemu with the command "kvm".  However,
as far as I can tell, "kvm" being aliased to the appropriate qemu system
binary is Debian specific.  The binary names from qemu upstream -
qemu-system-$ARCH - also aren't universal, but they are more common (they
should be good for both Debian and Fedora at least).

In order to still get KVM acceleration when available, we use the option
"-M accel=kvm:tcg" to tell qemu to try using either KVM or TCG in that
order

A number of the places we invoked "kvm" are expecting specifically an x86
guest, and so it's also safer to explicitly invoke qemu-system-x86_64.

Some others appear to be independent of the target arch (just wanting the
same arch as the host to allow KVM acceleration).  Although I suspect there
may be more subtle x86 specific options in the qemu command lines, attempt
to preserve arch independence by using $(uname -m).

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
David Gibson 2022-07-06 17:28:58 +10:00 committed by Stefano Brivio
parent c4d8a77512
commit 7bcc5930a6
7 changed files with 43 additions and 34 deletions
test/distro

View file

@ -12,7 +12,7 @@
# Author: Stefano Brivio <sbrivio@redhat.com>
temp PIDFILE
htools wget virt-edit guestfish head sed cat kill qemu-system-aarch64 qemu-system-ppc64
htools wget virt-edit guestfish head sed cat kill qemu-system-x86_64 qemu-system-aarch64 qemu-system-ppc64
# Quick pasta test: send message from init to ns, and from ns to init
def distro_quick_pasta_test
@ -54,7 +54,7 @@ host guestfish --rw -a __IMG__ -i rm /etc/init.d/cloud-init
host guestfish --rw -a __IMG__ -i rm /etc/init.d/cloud-init-local
host guestfish --rw -a __IMG__ -i copy-in __GUEST_FILES__ /root/
host ./qrap 5 kvm -M pc -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none -drive file=__IMG__,if=virtio -net socket,fd=5 -net nic,model=virtio
host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none -drive file=__IMG__,if=virtio -net socket,fd=5 -net nic,model=virtio
host PS1='$ '
sleep 2
host apt-get update
@ -81,7 +81,7 @@ host virt-edit -a __IMG__ /etc/systemd/system/getty.target.wants/getty@tty1.serv
host guestfish --rw -a __IMG__ -i rm /lib/systemd/system/serial-getty@.service
host guestfish --rw -a __IMG__ -i copy-in __GUEST_FILES__ /root/
host ./qrap 5 kvm -M pc -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __IMG__ -net socket,fd=5 -net nic,model=virtio
host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __IMG__ -net socket,fd=5 -net nic,model=virtio
host PS1='$ '
sleep 2
host apt-get update
@ -105,7 +105,7 @@ host virt-edit -a __IMG__ /etc/systemd/system/getty.target.wants/getty@tty1.serv
host guestfish --rw -a __IMG__ -i rm /lib/systemd/system/serial-getty@.service
host guestfish --rw -a __IMG__ -i copy-in __GUEST_FILES__ /root/
host ./qrap 5 kvm -M pc -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __IMG__ -net socket,fd=5 -net nic,model=virtio
host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __IMG__ -net socket,fd=5 -net nic,model=virtio
host PS1='$ '
sleep 2
host apt-get update
@ -193,7 +193,7 @@ host virt-edit -a __IMG__ /etc/systemd/system/getty.target.wants/getty@tty1.serv
host guestfish --rw -a __IMG__ -i rm /lib/systemd/system/serial-getty@.service
host guestfish --rw -a __IMG__ -i copy-in __GUEST_FILES__ /root/
host ./qrap 5 kvm -M pc -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __IMG__ -net socket,fd=5 -net nic,model=virtio
host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __IMG__ -net socket,fd=5 -net nic,model=virtio
sleep 2
host apt-get update
host apt-get -y install make gcc netcat-openbsd
@ -275,7 +275,7 @@ host virt-edit -a __IMG__ /etc/systemd/system/getty.target.wants/getty@tty1.serv
host guestfish --rw -a __IMG__ -i rm /lib/systemd/system/serial-getty@.service
host guestfish --rw -a __IMG__ -i copy-in __GUEST_FILES__ /root/
host ./qrap 5 kvm -M pc -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __IMG__ -net socket,fd=5 -net nic,model=virtio
host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __IMG__ -net socket,fd=5 -net nic,model=virtio
sleep 2
host apt-get update
host apt-get -y install make gcc netcat-openbsd