[libvirt] [PATCH v2] qemu: use default machine type if missing it in qemu command line

Eric Blake eblake at redhat.com
Thu Nov 1 15:01:53 UTC 2012


On 11/01/2012 05:46 AM, Guannan Ren wrote:
> BZ:https://bugzilla.redhat.com/show_bug.cgi?id=871273
> when using virsh qemu-attach to attach an existing qemu process,
> if it misses the -M option in qemu command line, libvirtd crashed
> because the NULL value of def->os.machine in later use.
> 
> Example:
> /usr/libexec/qemu-kvm -name foo \
>                       -cdrom /var/lib/libvirt/images/boot.img \
>                       -monitor unix:/tmp/demo,server,nowait \
> 
> error: End of file while reading data: Input/output error
> error: Failed to reconnect to the hypervisor
> 
> This patch tries to set default machine type if the value of
> def->os.machine is still NULL after qemu command line parsing.
> ---
>  src/qemu/qemu_capabilities.c |    4 +++-
>  src/qemu/qemu_command.c      |   11 +++++++++++
>  src/qemu/qemu_driver.c       |    7 +++++--
>  3 files changed, 19 insertions(+), 3 deletions(-)

ACK.  This fixes the problems I saw in v1 - def->os.machine can still be
NULL (although less likely in the normal case of learning the default
machine type), but now we don't dereference the NULL.

-- 
Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 617 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20121101/396dae42/attachment-0001.sig>


More information about the libvir-list mailing list