mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-27 02:51:16 +00:00
Fix QEMU ARGV detection with kvm >= 85
This commit is contained in:
parent
9927ca6274
commit
426f9772b8
@ -1,3 +1,11 @@
|
|||||||
|
Mon May 11 16:15:22 BST 2009 Daniel P. Berrange <berrange@redhat.com>
|
||||||
|
|
||||||
|
Fix QEMU ARGV detection with kvm >= 85
|
||||||
|
* src/qemu_conf.c: Increase limit on QEMU -help output size.
|
||||||
|
Improve error reporting when handling help output
|
||||||
|
* src/qemu_driver.c: Don't overwrite errors when extracting
|
||||||
|
QEMU versio ninfo
|
||||||
|
|
||||||
Mon May 11 15:55:22 BST 2009 Daniel P. Berrange <berrange@redhat.com>
|
Mon May 11 15:55:22 BST 2009 Daniel P. Berrange <berrange@redhat.com>
|
||||||
|
|
||||||
* src/virsh.c: Report detailed error if initial connection open
|
* src/virsh.c: Report detailed error if initial connection open
|
||||||
|
@ -431,18 +431,28 @@ int qemudExtractVersionInfo(const char *qemu,
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
char *help = NULL;
|
char *help = NULL;
|
||||||
enum { MAX_HELP_OUTPUT_SIZE = 8192 };
|
enum { MAX_HELP_OUTPUT_SIZE = 1024*64 };
|
||||||
int len = virFileReadLimFD(newstdout, MAX_HELP_OUTPUT_SIZE, &help);
|
int len = virFileReadLimFD(newstdout, MAX_HELP_OUTPUT_SIZE, &help);
|
||||||
if (len < 0)
|
if (len < 0) {
|
||||||
|
virReportSystemError(NULL, errno, "%s",
|
||||||
|
_("Unable to read QEMU help output"));
|
||||||
goto cleanup2;
|
goto cleanup2;
|
||||||
|
}
|
||||||
|
|
||||||
if (sscanf(help, "QEMU PC emulator version %u.%u.%u (kvm-%u)",
|
if (sscanf(help, "QEMU PC emulator version %u.%u.%u (kvm-%u)",
|
||||||
&major, &minor, µ, &kvm_version) != 4)
|
&major, &minor, µ, &kvm_version) != 4)
|
||||||
kvm_version = 0;
|
kvm_version = 0;
|
||||||
|
|
||||||
if (!kvm_version && sscanf(help, "QEMU PC emulator version %u.%u.%u",
|
if (!kvm_version &&
|
||||||
&major, &minor, µ) != 3)
|
sscanf(help, "QEMU PC emulator version %u.%u.%u",
|
||||||
|
&major, &minor, µ) != 3) {
|
||||||
|
char *eol = strchr(help, '\n');
|
||||||
|
if (eol) *eol = '\0';
|
||||||
|
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
||||||
|
_("cannot parse QEMU version number in '%s'"),
|
||||||
|
help);
|
||||||
goto cleanup2;
|
goto cleanup2;
|
||||||
|
}
|
||||||
|
|
||||||
version = (major * 1000 * 1000) + (minor * 1000) + micro;
|
version = (major * 1000 * 1000) + (minor * 1000) + micro;
|
||||||
|
|
||||||
|
@ -1391,12 +1391,8 @@ static int qemudStartVMDaemon(virConnectPtr conn,
|
|||||||
|
|
||||||
if (qemudExtractVersionInfo(emulator,
|
if (qemudExtractVersionInfo(emulator,
|
||||||
NULL,
|
NULL,
|
||||||
&qemuCmdFlags) < 0) {
|
&qemuCmdFlags) < 0)
|
||||||
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
|
||||||
_("Cannot determine QEMU argv syntax %s"),
|
|
||||||
emulator);
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
if (qemuPrepareHostDevices(conn, vm->def) < 0)
|
if (qemuPrepareHostDevices(conn, vm->def) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -3715,12 +3711,8 @@ static int qemudDomainChangeEjectableMedia(virConnectPtr conn,
|
|||||||
|
|
||||||
if (qemudExtractVersionInfo(vm->def->emulator,
|
if (qemudExtractVersionInfo(vm->def->emulator,
|
||||||
NULL,
|
NULL,
|
||||||
&qemuCmdFlags) < 0) {
|
&qemuCmdFlags) < 0)
|
||||||
qemudReportError(conn, dom, NULL, VIR_ERR_INTERNAL_ERROR,
|
|
||||||
_("Cannot determine QEMU argv syntax %s"),
|
|
||||||
vm->def->emulator);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
|
|
||||||
if (qemuCmdFlags & QEMUD_CMD_FLAG_DRIVE) {
|
if (qemuCmdFlags & QEMUD_CMD_FLAG_DRIVE) {
|
||||||
if (!(devname = qemudDiskDeviceName(conn, newdisk)))
|
if (!(devname = qemudDiskDeviceName(conn, newdisk)))
|
||||||
|
Loading…
Reference in New Issue
Block a user