mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-04 21:47:16 +03:00
qemu: Introduce qemuDomainUpdateQEMUCaps()
This function updates the used QEMU capabilities of @vm by querying the QEMU capabilities cache. Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com> Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com> Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
a4c12a5096
commit
9f81dc1081
@ -13122,6 +13122,31 @@ qemuDomainFixupCPUs(virDomainObjPtr vm,
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* qemuDomainUpdateQEMUCaps:
|
||||
* @vm: domain object
|
||||
* @qemuCapsCache: cache of QEMU capabilities
|
||||
*
|
||||
* This function updates the used QEMU capabilities of @vm by querying
|
||||
* the QEMU capabilities cache.
|
||||
*
|
||||
* Returns 0 on success, -1 on error.
|
||||
*/
|
||||
int
|
||||
qemuDomainUpdateQEMUCaps(virDomainObjPtr vm,
|
||||
virFileCachePtr qemuCapsCache)
|
||||
{
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
|
||||
virObjectUnref(priv->qemuCaps);
|
||||
if (!(priv->qemuCaps = virQEMUCapsCacheLookupCopy(qemuCapsCache,
|
||||
vm->def->emulator,
|
||||
vm->def->os.machine)))
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
qemuDomainGetMachineName(virDomainObjPtr vm)
|
||||
{
|
||||
|
@ -1037,6 +1037,10 @@ int
|
||||
qemuDomainFixupCPUs(virDomainObjPtr vm,
|
||||
virCPUDefPtr *origCPU);
|
||||
|
||||
int
|
||||
qemuDomainUpdateQEMUCaps(virDomainObjPtr vm,
|
||||
virFileCachePtr qemuCapsCache);
|
||||
|
||||
char *
|
||||
qemuDomainGetMachineName(virDomainObjPtr vm);
|
||||
|
||||
|
@ -5298,10 +5298,7 @@ qemuProcessInit(virQEMUDriverPtr driver,
|
||||
}
|
||||
|
||||
VIR_DEBUG("Determining emulator version");
|
||||
virObjectUnref(priv->qemuCaps);
|
||||
if (!(priv->qemuCaps = virQEMUCapsCacheLookupCopy(driver->qemuCapsCache,
|
||||
vm->def->emulator,
|
||||
vm->def->os.machine)))
|
||||
if (qemuDomainUpdateQEMUCaps(vm, driver->qemuCapsCache) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (flags & VIR_QEMU_PROCESS_START_STANDALONE)
|
||||
@ -7403,10 +7400,7 @@ int qemuProcessAttach(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
goto error;
|
||||
|
||||
VIR_DEBUG("Determining emulator version");
|
||||
virObjectUnref(priv->qemuCaps);
|
||||
if (!(priv->qemuCaps = virQEMUCapsCacheLookupCopy(driver->qemuCapsCache,
|
||||
vm->def->emulator,
|
||||
vm->def->os.machine)))
|
||||
if (qemuDomainUpdateQEMUCaps(vm, driver->qemuCapsCache) < 0)
|
||||
goto error;
|
||||
|
||||
VIR_DEBUG("Preparing monitor state");
|
||||
@ -7869,9 +7863,7 @@ qemuProcessReconnect(void *opaque)
|
||||
* caps in the domain status, so re-query them
|
||||
*/
|
||||
if (!priv->qemuCaps &&
|
||||
!(priv->qemuCaps = virQEMUCapsCacheLookupCopy(driver->qemuCapsCache,
|
||||
obj->def->emulator,
|
||||
obj->def->os.machine)))
|
||||
(qemuDomainUpdateQEMUCaps(obj, driver->qemuCapsCache) < 0))
|
||||
goto error;
|
||||
|
||||
/* In case the domain shutdown while we were not running,
|
||||
|
Loading…
x
Reference in New Issue
Block a user