qemu: recognize -machine accel=kvm when parsing native
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 <a9da18479c871fe903d9590822cfe2629c6a4d11@redhat.com>

zippy2/libvirt,andreabolognani/libvirt,libvirt/libvirt,zhlcindy/libvirt-1.1.4-maintain,jardasgit/libvirt,nertpinx/libvirt,rlaager/libvirt,fabianfreyer/libvirt,jardasgit/libvirt,elmarco/libvirt,libvirt/libvirt,andreabolognani/libvirt,nertpinx/libvirt,elmarco/libvirt,zhlcindy/libvirt-1.1.4-maintain,taget/libvirt,andreabolognani/libvirt,cbosdo/libvirt,jfehlig/libvirt,andreabolognani/libvirt,agx/libvirt,olafhering/libvirt,shugaoye/libvirt,agx/libvirt,crobinso/libvirt,datto/libvirt,jfehlig/libvirt,nertpinx/libvirt,taget/libvirt,crobinso/libvirt,datto/libvirt,jardasgit/libvirt,andreabolognani/libvirt,VenkatDatta/libvirt,olafhering/libvirt,eskultety/libvirt,rlaager/libvirt,zhlcindy/libvirt-1.1.4-maintain,VenkatDatta/libvirt,fabianfreyer/libvirt,shugaoye/libvirt,fabianfreyer/libvirt,zhlcindy/libvirt-1.1.4-maintain,agx/libvirt,rlaager/libvirt,nertpinx/libvirt,libvirt/libvirt,cbosdo/libvirt,zippy2/libvirt,eskultety/libvirt,shugaoye/libvirt,taget/libvirt,elmarco/libvirt,zippy2/libvirt,taget/libvirt,cbosdo/libvirt,jardasgit/libvirt,olafhering/libvirt,cbosdo/libvirt,elmarco/libvirt,zhlcindy/libvirt-1.1.4-maintain,VenkatDatta/libvirt,libvirt/libvirt,agx/libvirt,cbosdo/libvirt,VenkatDatta/libvirt,olafhering/libvirt,nertpinx/libvirt,jfehlig/libvirt,rlaager/libvirt,agx/libvirt,datto/libvirt,fabianfreyer/libvirt,eskultety/libvirt,elmarco/libvirt,jfehlig/libvirt,jardasgit/libvirt,crobinso/libvirt,VenkatDatta/libvirt,rlaager/libvirt,eskultety/libvirt,crobinso/libvirt,shugaoye/libvirt,eskultety/libvirt,datto/libvirt,taget/libvirt,shugaoye/libvirt,fabianfreyer/libvirt,datto/libvirt,zippy2/libvirt