mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 03:12:22 +00:00
Only enforce check for YAJL when starting a VM
The previous check for YAJL would have many undesirable consequences, the most important being that it caused the capabilities XML to lose 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@redhat.com>
This commit is contained in:
parent
a56c347080
commit
3399875965
@ -661,7 +661,8 @@ qemuCapsInitGuest(virCapsPtr caps,
|
||||
|
||||
/* Ignore binary if extracting version info fails */
|
||||
if (binary &&
|
||||
qemuCapsExtractVersionInfo(binary, info->arch, NULL, &qemuCaps) < 0)
|
||||
qemuCapsExtractVersionInfo(binary, info->arch,
|
||||
false, NULL, &qemuCaps) < 0)
|
||||
VIR_FREE(binary);
|
||||
|
||||
/* qemu-kvm/kvm binaries can only be used if
|
||||
@ -683,7 +684,8 @@ qemuCapsInitGuest(virCapsPtr caps,
|
||||
continue;
|
||||
|
||||
if (qemuCapsExtractVersionInfo(kvmbin, info->arch,
|
||||
NULL, &kvmCaps) < 0) {
|
||||
false, NULL,
|
||||
&kvmCaps) < 0) {
|
||||
VIR_FREE(kvmbin);
|
||||
continue;
|
||||
}
|
||||
@ -1489,7 +1491,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)
|
||||
{
|
||||
@ -1522,7 +1526,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. */
|
||||
@ -1600,7 +1605,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;
|
||||
}
|
||||
|
||||
|
@ -169,7 +169,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);
|
||||
|
||||
|
@ -776,7 +776,7 @@ qemuDomainAssignS390Addresses(virDomainDefPtr def, virBitmapPtr qemuCaps)
|
||||
if (!qemuCaps) {
|
||||
/* need to get information from real environment */
|
||||
if (qemuCapsExtractVersionInfo(def->emulator, def->os.arch,
|
||||
NULL,
|
||||
false, NULL,
|
||||
&localCaps) < 0)
|
||||
goto cleanup;
|
||||
qemuCaps = localCaps;
|
||||
@ -1015,6 +1015,7 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def,
|
||||
if (!qemuCaps) {
|
||||
/* need to get information from real environment */
|
||||
if (qemuCapsExtractVersionInfo(def->emulator, def->os.arch,
|
||||
false,
|
||||
NULL,
|
||||
&localCaps) < 0)
|
||||
goto cleanup;
|
||||
|
@ -4761,6 +4761,7 @@ static char *qemuDomainXMLToNative(virConnectPtr conn,
|
||||
}
|
||||
|
||||
if (qemuCapsExtractVersionInfo(def->emulator, def->os.arch,
|
||||
false,
|
||||
NULL,
|
||||
&qemuCaps) < 0)
|
||||
goto cleanup;
|
||||
|
@ -3104,6 +3104,7 @@ qemuProcessReconnect(void *opaque)
|
||||
*/
|
||||
if (!priv->qemuCaps &&
|
||||
qemuCapsExtractVersionInfo(obj->def->emulator, obj->def->os.arch,
|
||||
false,
|
||||
NULL,
|
||||
&priv->qemuCaps) < 0)
|
||||
goto error;
|
||||
@ -3504,6 +3505,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;
|
||||
@ -4248,6 +4250,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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user