[libvirt] [PATCH] qemu: Ignore unusable binaries

When initializing qemu guest capabilities, we should ignore qemu binaries that we are not able to extract version/help info from since they will be unusable for creating domains anyway. Ignoring them is also much better than letting initialization of qemu driver fail. --- src/qemu/qemu_capabilities.c | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index f86e7f5..63486cc 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -490,6 +490,12 @@ qemuCapsInitGuest(virCapsPtr caps, if (!binary) return 0; + /* Ignore binary if extracting version info fails */ + if (qemuCapsExtractVersionInfo(binary, info->arch, NULL, &qemuCaps) < 0) { + ret = 0; + goto cleanup; + } + if (stat(binary, &st) == 0) { binary_mtime = st.st_mtime; } else { @@ -554,9 +560,8 @@ qemuCapsInitGuest(virCapsPtr caps, !virCapabilitiesAddGuestFeature(guest, "cpuselection", 1, 0)) goto error; - if (qemuCapsExtractVersionInfo(binary, info->arch, NULL, &qemuCaps) < 0 || - (qemuCapsGet(qemuCaps, QEMU_CAPS_BOOTINDEX) && - !virCapabilitiesAddGuestFeature(guest, "deviceboot", 1, 0))) + if (qemuCapsGet(qemuCaps, QEMU_CAPS_BOOTINDEX) && + !virCapabilitiesAddGuestFeature(guest, "deviceboot", 1, 0)) goto error; if (hvm) { -- 1.7.4.1

On 04/04/2011 04:08 PM, Jiri Denemark wrote:
When initializing qemu guest capabilities, we should ignore qemu binaries that we are not able to extract version/help info from since they will be unusable for creating domains anyway. Ignoring them is also much better than letting initialization of qemu driver fail. --- src/qemu/qemu_capabilities.c | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-)
ACK. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

On Mon, Apr 04, 2011 at 16:23:23 -0600, Eric Blake wrote:
On 04/04/2011 04:08 PM, Jiri Denemark wrote:
When initializing qemu guest capabilities, we should ignore qemu binaries that we are not able to extract version/help info from since they will be unusable for creating domains anyway. Ignoring them is also much better than letting initialization of qemu driver fail. --- src/qemu/qemu_capabilities.c | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-)
ACK.
Thanks, pushed. Jirka
participants (2)
-
Eric Blake
-
Jiri Denemark