|
Mark McLoughlin |
c6d11b |
From 2b3fcdc378e7bec5c1a78b81632756e92930fd24 Mon Sep 17 00:00:00 2001
|
|
Mark McLoughlin |
c6d11b |
From: Daniel P. Berrange <berrange@redhat.com>
|
|
Mark McLoughlin |
c6d11b |
Date: Mon, 11 May 2009 15:14:24 +0000
|
|
Mark McLoughlin |
c6d11b |
Subject: [PATCH 1/1] Fix QEMU ARGV detection with kvm >= 85
|
|
Mark McLoughlin |
c6d11b |
|
|
Mark McLoughlin |
c6d11b |
---
|
|
Mark McLoughlin |
c6d11b |
src/qemu_conf.c | 18 ++++++++++++++----
|
|
Mark McLoughlin |
c6d11b |
src/qemu_driver.c | 12 ++----------
|
|
Mark McLoughlin |
c6d11b |
2 files changed, 16 insertions(+), 14 deletions(-)
|
|
Mark McLoughlin |
c6d11b |
|
|
Mark McLoughlin |
c6d11b |
diff --git a/src/qemu_conf.c b/src/qemu_conf.c
|
|
Mark McLoughlin |
c6d11b |
index 9cb71eb..a57d3ab 100644
|
|
Mark McLoughlin |
c6d11b |
--- a/src/qemu_conf.c
|
|
Mark McLoughlin |
c6d11b |
+++ b/src/qemu_conf.c
|
|
Mark McLoughlin |
c6d11b |
@@ -431,18 +431,28 @@ int qemudExtractVersionInfo(const char *qemu,
|
|
Mark McLoughlin |
c6d11b |
return -1;
|
|
Mark McLoughlin |
c6d11b |
|
|
Mark McLoughlin |
c6d11b |
char *help = NULL;
|
|
Mark McLoughlin |
c6d11b |
- enum { MAX_HELP_OUTPUT_SIZE = 8192 };
|
|
Mark McLoughlin |
c6d11b |
+ enum { MAX_HELP_OUTPUT_SIZE = 1024*64 };
|
|
Mark McLoughlin |
c6d11b |
int len = virFileReadLimFD(newstdout, MAX_HELP_OUTPUT_SIZE, &help;;
|
|
Mark McLoughlin |
c6d11b |
- if (len < 0)
|
|
Mark McLoughlin |
c6d11b |
+ if (len < 0) {
|
|
Mark McLoughlin |
c6d11b |
+ virReportSystemError(NULL, errno, "%s",
|
|
Mark McLoughlin |
c6d11b |
+ _("Unable to read QEMU help output"));
|
|
Mark McLoughlin |
c6d11b |
goto cleanup2;
|
|
Mark McLoughlin |
c6d11b |
+ }
|
|
Mark McLoughlin |
c6d11b |
|
|
Mark McLoughlin |
c6d11b |
if (sscanf(help, "QEMU PC emulator version %u.%u.%u (kvm-%u)",
|
|
Mark McLoughlin |
c6d11b |
&major, &minor, µ, &kvm_version) != 4)
|
|
Mark McLoughlin |
c6d11b |
kvm_version = 0;
|
|
Mark McLoughlin |
c6d11b |
|
|
Mark McLoughlin |
c6d11b |
- if (!kvm_version && sscanf(help, "QEMU PC emulator version %u.%u.%u",
|
|
Mark McLoughlin |
c6d11b |
- &major, &minor, µ) != 3)
|
|
Mark McLoughlin |
c6d11b |
+ if (!kvm_version &&
|
|
Mark McLoughlin |
c6d11b |
+ sscanf(help, "QEMU PC emulator version %u.%u.%u",
|
|
Mark McLoughlin |
c6d11b |
+ &major, &minor, µ) != 3) {
|
|
Mark McLoughlin |
c6d11b |
+ char *eol = strchr(help, '\n');
|
|
Mark McLoughlin |
c6d11b |
+ if (eol) *eol = '\0';
|
|
Mark McLoughlin |
c6d11b |
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
|
Mark McLoughlin |
c6d11b |
+ _("cannot parse QEMU version number in '%s'"),
|
|
Mark McLoughlin |
c6d11b |
+ help);
|
|
Mark McLoughlin |
c6d11b |
goto cleanup2;
|
|
Mark McLoughlin |
c6d11b |
+ }
|
|
Mark McLoughlin |
c6d11b |
|
|
Mark McLoughlin |
c6d11b |
version = (major * 1000 * 1000) + (minor * 1000) + micro;
|
|
Mark McLoughlin |
c6d11b |
|
|
Mark McLoughlin |
c6d11b |
diff --git a/src/qemu_driver.c b/src/qemu_driver.c
|
|
Mark McLoughlin |
c6d11b |
index 30642d5..bd60b29 100644
|
|
Mark McLoughlin |
c6d11b |
--- a/src/qemu_driver.c
|
|
Mark McLoughlin |
c6d11b |
+++ b/src/qemu_driver.c
|
|
Mark McLoughlin |
c6d11b |
@@ -1391,12 +1391,8 @@ static int qemudStartVMDaemon(virConnectPtr conn,
|
|
Mark McLoughlin |
c6d11b |
|
|
Mark McLoughlin |
c6d11b |
if (qemudExtractVersionInfo(emulator,
|
|
Mark McLoughlin |
c6d11b |
NULL,
|
|
Mark McLoughlin |
c6d11b |
- &qemuCmdFlags) < 0) {
|
|
Mark McLoughlin |
c6d11b |
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
|
Mark McLoughlin |
c6d11b |
- _("Cannot determine QEMU argv syntax %s"),
|
|
Mark McLoughlin |
c6d11b |
- emulator);
|
|
Mark McLoughlin |
c6d11b |
+ &qemuCmdFlags) < 0)
|
|
Mark McLoughlin |
c6d11b |
goto cleanup;
|
|
Mark McLoughlin |
c6d11b |
- }
|
|
Mark McLoughlin |
c6d11b |
|
|
Mark McLoughlin |
c6d11b |
if (qemuPrepareHostDevices(conn, vm->def) < 0)
|
|
Mark McLoughlin |
c6d11b |
goto cleanup;
|
|
Mark McLoughlin |
c6d11b |
@@ -3715,12 +3711,8 @@ static int qemudDomainChangeEjectableMedia(virConnectPtr conn,
|
|
Mark McLoughlin |
c6d11b |
|
|
Mark McLoughlin |
c6d11b |
if (qemudExtractVersionInfo(vm->def->emulator,
|
|
Mark McLoughlin |
c6d11b |
NULL,
|
|
Mark McLoughlin |
c6d11b |
- &qemuCmdFlags) < 0) {
|
|
Mark McLoughlin |
c6d11b |
- qemudReportError(conn, dom, NULL, VIR_ERR_INTERNAL_ERROR,
|
|
Mark McLoughlin |
c6d11b |
- _("Cannot determine QEMU argv syntax %s"),
|
|
Mark McLoughlin |
c6d11b |
- vm->def->emulator);
|
|
Mark McLoughlin |
c6d11b |
+ &qemuCmdFlags) < 0)
|
|
Mark McLoughlin |
c6d11b |
return -1;
|
|
Mark McLoughlin |
c6d11b |
- }
|
|
Mark McLoughlin |
c6d11b |
|
|
Mark McLoughlin |
c6d11b |
if (qemuCmdFlags & QEMUD_CMD_FLAG_DRIVE) {
|
|
Mark McLoughlin |
c6d11b |
if (!(devname = qemudDiskDeviceName(conn, newdisk)))
|
|
Mark McLoughlin |
c6d11b |
--
|
|
Mark McLoughlin |
c6d11b |
1.6.0.6
|
|
Mark McLoughlin |
c6d11b |
|