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@xxxxxxxxxx> --- src/qemu/qemu_domain.c | 26 -------------------------- src/qemu/qemu_domain.h | 4 ---- src/qemu/qemu_process.c | 30 +++++++++++++++++++++++++++++- 3 files changed, 29 insertions(+), 31 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 168e7464a9..abe1396e3a 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -15022,32 +15022,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) { diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index db45a932dc..f626d3a54c 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -1155,10 +1155,6 @@ int qemuDomainFixupCPUs(virDomainObjPtr vm, virCPUDefPtr *origCPU); -int -qemuDomainUpdateQEMUCaps(virDomainObjPtr vm, - virFileCachePtr qemuCapsCache); - char * qemuDomainGetMachineName(virDomainObjPtr vm); diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index a76a8da841..ad3129c7bd 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -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) -- 2.23.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list