]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemu: use default machine type if missing it in qemu command line
authorGuannan Ren <gren@redhat.com>
Thu, 1 Nov 2012 11:43:03 +0000 (19:43 +0800)
committerGuannan Ren <gren@redhat.com>
Fri, 2 Nov 2012 04:55:29 +0000 (12:55 +0800)
commit1851a0c8640f0b42e20a2ccfd5cdb9a9409517ec
treebbbfe4f3d378dec9b1e85c417a4e189d0c8d83a5
parent2b435c153e53e78092025c01ddc43265761b72fa
qemu: use default machine type if missing it in qemu command line

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
src/qemu/qemu_command.c
src/qemu/qemu_driver.c