Skip to content

Commit

Permalink
Find qemu in /usr/libexec or via qemu-system-$(arch)
Browse files Browse the repository at this point in the history
`qemu-kvm` is going away in Fedora; invoke qemu how libvirt does it.

Similarly on RHEL, it's in `/usr/libexec` as QEMU is an implementation
detail of libvirt (or something), so let's find it there.
  • Loading branch information
cgwalters committed Feb 7, 2019
1 parent ed92c12 commit eec20c7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/cmd-run
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,8 @@ fi

set -- -drive if=virtio"${vm_drive_args:-}",file="${VM_DISK}" "$@"

exec qemu-kvm -name coreos -m "${VM_MEMORY}" -nographic \
# shellcheck disable=SC2086
exec ${QEMU_KVM} -name coreos -m "${VM_MEMORY}" -nographic \
-netdev user,id=eth0,hostname=coreos"${hostfwd:-}" \
-device virtio-net-pci,netdev=eth0 \
-object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-pci,rng=rng0 \
Expand Down
8 changes: 7 additions & 1 deletion src/cmdlib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,12 @@ EOF
fi
}

if [ -x /usr/libexec/qemu-kvm ]; then
QEMU_KVM="/usr/libexec/qemu-kvm"
else
QEMU_KVM="qemu-system-$(arch) -accel kvm"
fi

runvm() {
local vmpreparedir=${workdir}/tmp/supermin.prepare
local vmbuilddir=${workdir}/tmp/supermin.build
Expand Down Expand Up @@ -239,7 +245,7 @@ EOF
srcvirtfs=("-virtfs" "local,id=source,path=${workdir}/src/config,security_model=none,mount_tag=source")
fi

qemu-kvm -nodefaults -nographic -m 2048 -no-reboot \
${QEMU_KVM} -nodefaults -nographic -m 2048 -no-reboot \
-kernel "${vmbuilddir}/kernel" \
-initrd "${vmbuilddir}/initrd" \
-netdev user,id=eth0,hostname=supermin \
Expand Down
4 changes: 3 additions & 1 deletion src/gf-oemid
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ while [ $# -gt 0 ]; do
shift ;;
esac
done
exec qemu-kvm -cpu host,pmu=off "${args[@]}"
EOF
# Expand QEMU_KVM
# shellcheck disable=SC2086 disable=SC2016
echo "exec ${QEMU_KVM} "'-cpu host,pmu=off "${args[@]}"' >> "${qemu_wrapper}"
chmod +x "${qemu_wrapper}"

# This qemu wrapper doesn't work for some reason on EL7, so just skip
Expand Down

0 comments on commit eec20c7

Please sign in to comment.