qemu: Move and rename qemuDomainUpdateQEMUCaps

The function is now used only in qemu_process.c so move it there and
name it 'qemuProcessPrepareQEMUCaps' which is more appropriate to what
it's doing.

The reworded comment now mentions that it will also post-process the
caps for VM startup.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2019-11-24 09:16:11 +01:00
parent 530d7a73f4
commit dbbc9a3c40
3 changed files with 29 additions and 31 deletions

View File

@ -15065,32 +15065,6 @@ 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->virtType,
vm->def->emulator,
vm->def->os.machine)))
return -1;
return 0;
}
char *
qemuDomainGetMachineName(virDomainObjPtr vm)
{

View File

@ -1155,10 +1155,6 @@ int
qemuDomainFixupCPUs(virDomainObjPtr vm,
virCPUDefPtr *origCPU);
int
qemuDomainUpdateQEMUCaps(virDomainObjPtr vm,
virFileCachePtr qemuCapsCache);
char *
qemuDomainGetMachineName(virDomainObjPtr vm);

View File

@ -5486,6 +5486,34 @@ qemuProcessStartUpdateCustomCaps(virDomainObjPtr vm)
}
/**
* qemuProcessPrepareQEMUCaps:
* @vm: domain object
* @qemuCapsCache: cache of QEMU capabilities
*
* Prepare the capabilities of a QEMU process for startup. This includes
* copying the caps to a static cache and potential post-processing depending
* on the configuration of the VM and startup process.
*
* Returns 0 on success, -1 on error.
*/
static int
qemuProcessPrepareQEMUCaps(virDomainObjPtr vm,
virFileCachePtr qemuCapsCache)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
virObjectUnref(priv->qemuCaps);
if (!(priv->qemuCaps = virQEMUCapsCacheLookupCopy(qemuCapsCache,
vm->def->virtType,
vm->def->emulator,
vm->def->os.machine)))
return -1;
return 0;
}
/**
* qemuProcessInit:
*
@ -5537,7 +5565,7 @@ qemuProcessInit(virQEMUDriverPtr driver,
}
VIR_DEBUG("Determining emulator version");
if (qemuDomainUpdateQEMUCaps(vm, driver->qemuCapsCache) < 0)
if (qemuProcessPrepareQEMUCaps(vm, driver->qemuCapsCache) < 0)
goto cleanup;
if (flags & VIR_QEMU_PROCESS_START_STANDALONE)