]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemu: recognize -machine accel=kvm when parsing native
authorEric Blake <eblake@redhat.com>
Wed, 28 Aug 2013 03:45:46 +0000 (21:45 -0600)
committerEric Blake <eblake@redhat.com>
Fri, 6 Sep 2013 15:40:23 +0000 (09:40 -0600)
commit2b1ef11c6cb14239feaeb1e426d85377983accb8
tree46b1ccd71a9bae0f95fc84aba80ecd735ccb7a61
parent6a373fb2c95300d632a7371c893a301364f8dcb5
qemu: recognize -machine accel=kvm when parsing native

In Fedora 19, 'qemu-kvm' is a simple wrapper that calls
'qemu-system-x86_64 -machine accel=kvm'.  Attempting
to use 'virsh qemu-attach $pid' to a machine started as:

qemu-kvm -cdrom /var/lib/libvirt/images/foo.img \
 -monitor unix:/tmp/demo,server,nowait -name foo \
 --uuid cece4f9f-dff0-575d-0e8e-01fe380f12ea

was failing with:
error: XML error: No PCI buses available

because we did not see 'kvm' in the executable name read from
/proc/$pid/cmdline, and tried to assign os.machine as
"accel=kvm" instead of "pc"; this in turn led to refusal to
recognize the pci bus.

Noticed while investigating https://bugzilla.redhat.com/995312
although there are still other issues to fix before that bug
will be completely solved.

I've concluded that the existing parser code for native-to-xml
is a horrendous hodge-podge of ad-hoc approaches; I basically
rewrote the -machine section to be a bit saner.

* src/qemu/qemu_command.c (qemuParseCommandLine): Don't assume
-machine argument is always appropriate for os.machine; set
virtType if accel is present.

Signed-off-by: Eric Blake <eblake@redhat.com>
src/qemu/qemu_command.c