From: "Daniel P. Berrange" <berrange@xxxxxxxxxx> The previous check for YAJL would have many undesirable consequences, the most important being that it caused the capabilities XML to loose all <guest> elements. There is no user visible feedback as to what is wrong in this respect, merely a syslog message. The empty capabilities causes libvirtd to then throw away all guest XML configs that are stored. This changes the code so that the check for YAJL is only performed at the time we attempt to spawn a QEMU process error: Failed to start domain vm-vnc error: unsupported configuration: this qemu binary requires libvirt to be compiled with yajl Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx> --- src/qemu/qemu_capabilities.c | 13 +++++++++---- src/qemu/qemu_capabilities.h | 4 +++- src/qemu/qemu_command.c | 1 + src/qemu/qemu_driver.c | 1 + src/qemu/qemu_process.c | 3 +++ 5 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 1e12a39..1d6ab2d 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -691,7 +691,8 @@ qemuCapsInitGuest(virCapsPtr caps, return 0; /* Ignore binary if extracting version info fails */ - if (qemuCapsExtractVersionInfo(binary, info->arch, NULL, &qemuCaps) < 0) { + if (qemuCapsExtractVersionInfo(binary, info->arch, + false, NULL, &qemuCaps) < 0) { ret = 0; goto cleanup; } @@ -1472,7 +1473,9 @@ qemuCapsParseDeviceStr(const char *str, virBitmapPtr flags) return 0; } -int qemuCapsExtractVersionInfo(const char *qemu, const char *arch, +int qemuCapsExtractVersionInfo(const char *qemu, + const char *arch, + bool check_yajl, unsigned int *retversion, virBitmapPtr *retflags) { @@ -1505,7 +1508,8 @@ int qemuCapsExtractVersionInfo(const char *qemu, const char *arch, if (!(flags = qemuCapsNew()) || qemuCapsParseHelpStr(qemu, help, flags, - &version, &is_kvm, &kvm_version, true) == -1) + &version, &is_kvm, &kvm_version, + check_yajl) == -1) goto cleanup; /* Currently only x86_64 and i686 support PCI-multibus. */ @@ -1583,7 +1587,8 @@ int qemuCapsExtractVersion(virCapsPtr caps, return -1; } - if (qemuCapsExtractVersionInfo(binary, ut.machine, version, NULL) < 0) { + if (qemuCapsExtractVersionInfo(binary, ut.machine, false, + version, NULL) < 0) { return -1; } diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 83c135b..c14d53a 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -167,7 +167,9 @@ int qemuCapsProbeCPUModels(const char *qemu, int qemuCapsExtractVersion(virCapsPtr caps, unsigned int *version); -int qemuCapsExtractVersionInfo(const char *qemu, const char *arch, +int qemuCapsExtractVersionInfo(const char *qemu, + const char *arch, + bool check_yajl, unsigned int *version, virBitmapPtr *qemuCaps); diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 528b189..5959352 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -949,6 +949,7 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def) qemuDomainPCIAddressSetPtr addrs = NULL; if (qemuCapsExtractVersionInfo(def->emulator, def->os.arch, + false, NULL, &qemuCaps) < 0) goto cleanup; diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 2f93404..eb2ed0e 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -4757,6 +4757,7 @@ static char *qemuDomainXMLToNative(virConnectPtr conn, } if (qemuCapsExtractVersionInfo(def->emulator, def->os.arch, + false, NULL, &qemuCaps) < 0) goto cleanup; diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index c5140c3..fd4c9c9 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -3073,6 +3073,7 @@ qemuProcessReconnect(void *opaque) */ if (!priv->qemuCaps && qemuCapsExtractVersionInfo(obj->def->emulator, obj->def->os.arch, + false, NULL, &priv->qemuCaps) < 0) goto error; @@ -3478,6 +3479,7 @@ int qemuProcessStart(virConnectPtr conn, qemuCapsFree(priv->qemuCaps); priv->qemuCaps = NULL; if (qemuCapsExtractVersionInfo(vm->def->emulator, vm->def->os.arch, + true, NULL, &priv->qemuCaps) < 0) goto cleanup; @@ -4237,6 +4239,7 @@ int qemuProcessAttach(virConnectPtr conn ATTRIBUTE_UNUSED, priv->qemuCaps = NULL; if (qemuCapsExtractVersionInfo(vm->def->emulator, vm->def->os.arch, + false, NULL, &priv->qemuCaps) < 0) goto cleanup; -- 1.7.10.4 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list