mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 17:34:18 +03:00
qemu: pass only host arch instead of the whole virCaps
This is a preparation for following patches where we switch to virFileCache for QEMU capabilities cache The host arch will always remain the same but virCaps may change. Now the host arch is stored while creating new qemu capabilities cache. It removes the need to pass virCaps into virQEMUCapsCache*() functions. Signed-off-by: Pavel Hrdina <phrdina@redhat.com> Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
parent
13554a9e7f
commit
f366cfed62
@ -975,7 +975,7 @@ virQEMUCapsInitGuest(virCapsPtr caps,
|
||||
|
||||
/* Ignore binary if extracting version info fails */
|
||||
if (binary) {
|
||||
if (!(qemubinCaps = virQEMUCapsCacheLookup(caps, cache, binary))) {
|
||||
if (!(qemubinCaps = virQEMUCapsCacheLookup(cache, binary))) {
|
||||
virResetLastError();
|
||||
VIR_FREE(binary);
|
||||
}
|
||||
@ -1015,7 +1015,7 @@ virQEMUCapsInitGuest(virCapsPtr caps,
|
||||
if (!kvmbin)
|
||||
continue;
|
||||
|
||||
if (!(kvmbinCaps = virQEMUCapsCacheLookup(caps, cache, kvmbin))) {
|
||||
if (!(kvmbinCaps = virQEMUCapsCacheLookup(cache, kvmbin))) {
|
||||
virResetLastError();
|
||||
VIR_FREE(kvmbin);
|
||||
continue;
|
||||
@ -1155,7 +1155,7 @@ virQEMUCapsInitGuestFromBinary(virCapsPtr caps,
|
||||
|
||||
|
||||
virCPUDefPtr
|
||||
virQEMUCapsProbeHostCPUForEmulator(virCapsPtr caps,
|
||||
virQEMUCapsProbeHostCPUForEmulator(virArch hostArch,
|
||||
virQEMUCapsPtr qemuCaps,
|
||||
virDomainVirtType type)
|
||||
{
|
||||
@ -1166,7 +1166,7 @@ virQEMUCapsProbeHostCPUForEmulator(virCapsPtr caps,
|
||||
if (virQEMUCapsGetCPUDefinitions(qemuCaps, type, &models, &nmodels) < 0)
|
||||
return NULL;
|
||||
|
||||
cpu = virCPUGetHost(caps->host.arch, VIR_CPU_TYPE_GUEST, NULL,
|
||||
cpu = virCPUGetHost(hostArch, VIR_CPU_TYPE_GUEST, NULL,
|
||||
(const char **) models, nmodels);
|
||||
|
||||
virStringListFreeCount(models, nmodels);
|
||||
@ -2192,7 +2192,7 @@ int virQEMUCapsGetDefaultVersion(virCapsPtr caps,
|
||||
return -1;
|
||||
}
|
||||
|
||||
qemucaps = virQEMUCapsCacheLookup(caps, capsCache, capsdata->emulator);
|
||||
qemucaps = virQEMUCapsCacheLookup(capsCache, capsdata->emulator);
|
||||
VIR_FREE(capsdata);
|
||||
if (!qemucaps)
|
||||
return -1;
|
||||
@ -3494,7 +3494,7 @@ virQEMUCapsNewHostCPUModel(void)
|
||||
|
||||
void
|
||||
virQEMUCapsInitHostCPUModel(virQEMUCapsPtr qemuCaps,
|
||||
virCapsPtr caps,
|
||||
virArch hostArch,
|
||||
virDomainVirtType type)
|
||||
{
|
||||
virCPUDefPtr cpu = NULL;
|
||||
@ -3504,7 +3504,7 @@ virQEMUCapsInitHostCPUModel(virQEMUCapsPtr qemuCaps,
|
||||
size_t i;
|
||||
int rc;
|
||||
|
||||
if (!caps || !virQEMUCapsGuestIsNative(caps->host.arch, qemuCaps->arch))
|
||||
if (!virQEMUCapsGuestIsNative(hostArch, qemuCaps->arch))
|
||||
return;
|
||||
|
||||
if (!(cpu = virQEMUCapsNewHostCPUModel()))
|
||||
@ -3515,7 +3515,7 @@ virQEMUCapsInitHostCPUModel(virQEMUCapsPtr qemuCaps,
|
||||
} else if (rc == 1) {
|
||||
VIR_DEBUG("No host CPU model info from QEMU; probing host CPU directly");
|
||||
|
||||
hostCPU = virQEMUCapsProbeHostCPUForEmulator(caps, qemuCaps, type);
|
||||
hostCPU = virQEMUCapsProbeHostCPUForEmulator(hostArch, qemuCaps, type);
|
||||
if (!hostCPU ||
|
||||
virCPUDefCopyModelFilter(cpu, hostCPU, true,
|
||||
virQEMUCapsCPUFilterFeatures,
|
||||
@ -3800,7 +3800,7 @@ virQEMUCapsCachePrivFree(virQEMUCapsCachePrivPtr priv)
|
||||
* </qemuCaps>
|
||||
*/
|
||||
int
|
||||
virQEMUCapsLoadCache(virCapsPtr caps,
|
||||
virQEMUCapsLoadCache(virArch hostArch,
|
||||
virQEMUCapsPtr qemuCaps,
|
||||
const char *filename)
|
||||
{
|
||||
@ -4017,8 +4017,8 @@ virQEMUCapsLoadCache(virCapsPtr caps,
|
||||
}
|
||||
VIR_FREE(nodes);
|
||||
|
||||
virQEMUCapsInitHostCPUModel(qemuCaps, caps, VIR_DOMAIN_VIRT_KVM);
|
||||
virQEMUCapsInitHostCPUModel(qemuCaps, caps, VIR_DOMAIN_VIRT_QEMU);
|
||||
virQEMUCapsInitHostCPUModel(qemuCaps, hostArch, VIR_DOMAIN_VIRT_KVM);
|
||||
virQEMUCapsInitHostCPUModel(qemuCaps, hostArch, VIR_DOMAIN_VIRT_QEMU);
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
@ -4331,8 +4331,7 @@ virQEMUCapsIsValid(virQEMUCapsPtr qemuCaps,
|
||||
|
||||
|
||||
static int
|
||||
virQEMUCapsInitCached(virCapsPtr caps,
|
||||
virQEMUCapsPtr *qemuCaps,
|
||||
virQEMUCapsInitCached(virQEMUCapsPtr *qemuCaps,
|
||||
const char *binary,
|
||||
const char *cacheDir,
|
||||
virQEMUCapsCachePrivPtr priv)
|
||||
@ -4379,7 +4378,7 @@ virQEMUCapsInitCached(virCapsPtr caps,
|
||||
if (VIR_STRDUP(qemuCapsNew->binary, binary) < 0)
|
||||
goto discard;
|
||||
|
||||
if (virQEMUCapsLoadCache(caps, qemuCapsNew, capsfile) < 0) {
|
||||
if (virQEMUCapsLoadCache(priv->hostArch, qemuCapsNew, capsfile) < 0) {
|
||||
VIR_WARN("Failed to load cached caps from '%s' for '%s': %s",
|
||||
capsfile, qemuCapsNew->binary, virGetLastErrorMessage());
|
||||
virResetLastError();
|
||||
@ -5217,7 +5216,7 @@ virQEMUCapsLogProbeFailure(const char *binary)
|
||||
|
||||
|
||||
virQEMUCapsPtr
|
||||
virQEMUCapsNewForBinaryInternal(virCapsPtr caps,
|
||||
virQEMUCapsNewForBinaryInternal(virArch hostArch,
|
||||
const char *binary,
|
||||
const char *libDir,
|
||||
uid_t runUid,
|
||||
@ -5275,8 +5274,8 @@ virQEMUCapsNewForBinaryInternal(virCapsPtr caps,
|
||||
qemuCaps->libvirtCtime = virGetSelfLastChanged();
|
||||
qemuCaps->libvirtVersion = LIBVIR_VERSION_NUMBER;
|
||||
|
||||
virQEMUCapsInitHostCPUModel(qemuCaps, caps, VIR_DOMAIN_VIRT_KVM);
|
||||
virQEMUCapsInitHostCPUModel(qemuCaps, caps, VIR_DOMAIN_VIRT_QEMU);
|
||||
virQEMUCapsInitHostCPUModel(qemuCaps, hostArch, VIR_DOMAIN_VIRT_KVM);
|
||||
virQEMUCapsInitHostCPUModel(qemuCaps, hostArch, VIR_DOMAIN_VIRT_QEMU);
|
||||
|
||||
cleanup:
|
||||
VIR_FREE(qmperr);
|
||||
@ -5289,19 +5288,19 @@ virQEMUCapsNewForBinaryInternal(virCapsPtr caps,
|
||||
}
|
||||
|
||||
static virQEMUCapsPtr
|
||||
virQEMUCapsNewForBinary(virCapsPtr caps,
|
||||
const char *binary,
|
||||
virQEMUCapsNewForBinary(const char *binary,
|
||||
const char *cacheDir,
|
||||
virQEMUCapsCachePrivPtr priv)
|
||||
{
|
||||
int rv;
|
||||
virQEMUCapsPtr qemuCaps = NULL;
|
||||
|
||||
if ((rv = virQEMUCapsInitCached(caps, &qemuCaps, binary, cacheDir, priv)) < 0)
|
||||
if ((rv = virQEMUCapsInitCached(&qemuCaps, binary, cacheDir, priv)) < 0)
|
||||
goto error;
|
||||
|
||||
if (rv == 0) {
|
||||
if (!(qemuCaps = virQEMUCapsNewForBinaryInternal(caps, binary,
|
||||
if (!(qemuCaps = virQEMUCapsNewForBinaryInternal(priv->hostArch,
|
||||
binary,
|
||||
priv->libDir,
|
||||
priv->runUid,
|
||||
priv->runGid,
|
||||
@ -5388,6 +5387,8 @@ virQEMUCapsCacheNew(const char *libDir,
|
||||
if (VIR_STRDUP(cache->priv->libDir, libDir) < 0)
|
||||
goto error;
|
||||
|
||||
cache->priv->hostArch = virArchFromHost();
|
||||
|
||||
cache->priv->runUid = runUid;
|
||||
cache->priv->runGid = runGid;
|
||||
|
||||
@ -5402,7 +5403,6 @@ virQEMUCapsCacheNew(const char *libDir,
|
||||
static void ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
|
||||
virQEMUCapsCacheValidate(virQEMUCapsCachePtr cache,
|
||||
const char *binary,
|
||||
virCapsPtr caps,
|
||||
virQEMUCapsPtr *qemuCaps)
|
||||
{
|
||||
if (*qemuCaps &&
|
||||
@ -5415,7 +5415,7 @@ virQEMUCapsCacheValidate(virQEMUCapsCachePtr cache,
|
||||
|
||||
if (!*qemuCaps) {
|
||||
VIR_DEBUG("Creating capabilities for %s", binary);
|
||||
*qemuCaps = virQEMUCapsNewForBinary(caps, binary,
|
||||
*qemuCaps = virQEMUCapsNewForBinary(binary,
|
||||
cache->cacheDir,
|
||||
cache->priv);
|
||||
if (*qemuCaps) {
|
||||
@ -5430,8 +5430,7 @@ virQEMUCapsCacheValidate(virQEMUCapsCachePtr cache,
|
||||
|
||||
|
||||
virQEMUCapsPtr
|
||||
virQEMUCapsCacheLookup(virCapsPtr caps,
|
||||
virQEMUCapsCachePtr cache,
|
||||
virQEMUCapsCacheLookup(virQEMUCapsCachePtr cache,
|
||||
const char *binary)
|
||||
{
|
||||
virQEMUCapsPtr ret = NULL;
|
||||
@ -5439,7 +5438,7 @@ virQEMUCapsCacheLookup(virCapsPtr caps,
|
||||
virMutexLock(&cache->lock);
|
||||
|
||||
ret = virHashLookup(cache->binaries, binary);
|
||||
virQEMUCapsCacheValidate(cache, binary, caps, &ret);
|
||||
virQEMUCapsCacheValidate(cache, binary, &ret);
|
||||
virObjectRef(ret);
|
||||
|
||||
virMutexUnlock(&cache->lock);
|
||||
@ -5450,12 +5449,11 @@ virQEMUCapsCacheLookup(virCapsPtr caps,
|
||||
|
||||
|
||||
virQEMUCapsPtr
|
||||
virQEMUCapsCacheLookupCopy(virCapsPtr caps,
|
||||
virQEMUCapsCachePtr cache,
|
||||
virQEMUCapsCacheLookupCopy(virQEMUCapsCachePtr cache,
|
||||
const char *binary,
|
||||
const char *machineType)
|
||||
{
|
||||
virQEMUCapsPtr qemuCaps = virQEMUCapsCacheLookup(caps, cache, binary);
|
||||
virQEMUCapsPtr qemuCaps = virQEMUCapsCacheLookup(cache, binary);
|
||||
virQEMUCapsPtr ret;
|
||||
|
||||
if (!qemuCaps)
|
||||
@ -5485,8 +5483,7 @@ virQEMUCapsCompareArch(const void *payload,
|
||||
|
||||
|
||||
virQEMUCapsPtr
|
||||
virQEMUCapsCacheLookupByArch(virCapsPtr caps,
|
||||
virQEMUCapsCachePtr cache,
|
||||
virQEMUCapsCacheLookupByArch(virQEMUCapsCachePtr cache,
|
||||
virArch arch)
|
||||
{
|
||||
virQEMUCapsPtr ret = NULL;
|
||||
@ -5512,7 +5509,7 @@ virQEMUCapsCacheLookupByArch(virCapsPtr caps,
|
||||
if (VIR_STRDUP(binary, ret->binary) < 0) {
|
||||
ret = NULL;
|
||||
} else {
|
||||
virQEMUCapsCacheValidate(cache, binary, caps, &ret);
|
||||
virQEMUCapsCacheValidate(cache, binary, &ret);
|
||||
VIR_FREE(binary);
|
||||
}
|
||||
} else {
|
||||
|
@ -504,15 +504,12 @@ void virQEMUCapsFilterByMachineType(virQEMUCapsPtr qemuCaps,
|
||||
virQEMUCapsCachePtr virQEMUCapsCacheNew(const char *libDir,
|
||||
const char *cacheDir,
|
||||
uid_t uid, gid_t gid);
|
||||
virQEMUCapsPtr virQEMUCapsCacheLookup(virCapsPtr caps,
|
||||
virQEMUCapsCachePtr cache,
|
||||
virQEMUCapsPtr virQEMUCapsCacheLookup(virQEMUCapsCachePtr cache,
|
||||
const char *binary);
|
||||
virQEMUCapsPtr virQEMUCapsCacheLookupCopy(virCapsPtr caps,
|
||||
virQEMUCapsCachePtr cache,
|
||||
virQEMUCapsPtr virQEMUCapsCacheLookupCopy(virQEMUCapsCachePtr cache,
|
||||
const char *binary,
|
||||
const char *machineType);
|
||||
virQEMUCapsPtr virQEMUCapsCacheLookupByArch(virCapsPtr caps,
|
||||
virQEMUCapsCachePtr cache,
|
||||
virQEMUCapsPtr virQEMUCapsCacheLookupByArch(virQEMUCapsCachePtr cache,
|
||||
virArch arch);
|
||||
void virQEMUCapsCacheFree(virQEMUCapsCachePtr cache);
|
||||
|
||||
|
@ -28,10 +28,13 @@
|
||||
#ifndef __QEMU_CAPSPRIV_H__
|
||||
# define __QEMU_CAPSPRIV_H__
|
||||
|
||||
# include "virarch.h"
|
||||
|
||||
struct _virQEMUCapsCachePriv {
|
||||
char *libDir;
|
||||
uid_t runUid;
|
||||
gid_t runGid;
|
||||
virArch hostArch;
|
||||
};
|
||||
typedef struct _virQEMUCapsCachePriv virQEMUCapsCachePriv;
|
||||
typedef virQEMUCapsCachePriv *virQEMUCapsCachePrivPtr;
|
||||
@ -46,14 +49,14 @@ struct _virQEMUCapsCache {
|
||||
virQEMUCapsPtr virQEMUCapsNewCopy(virQEMUCapsPtr qemuCaps);
|
||||
|
||||
virQEMUCapsPtr
|
||||
virQEMUCapsNewForBinaryInternal(virCapsPtr caps,
|
||||
virQEMUCapsNewForBinaryInternal(virArch hostArch,
|
||||
const char *binary,
|
||||
const char *libDir,
|
||||
uid_t runUid,
|
||||
gid_t runGid,
|
||||
bool qmpOnly);
|
||||
|
||||
int virQEMUCapsLoadCache(virCapsPtr caps,
|
||||
int virQEMUCapsLoadCache(virArch hostArch,
|
||||
virQEMUCapsPtr qemuCaps,
|
||||
const char *filename);
|
||||
char *virQEMUCapsFormatCache(virQEMUCapsPtr qemuCaps);
|
||||
@ -76,7 +79,7 @@ virQEMUCapsSetVersion(virQEMUCapsPtr qemuCaps,
|
||||
|
||||
void
|
||||
virQEMUCapsInitHostCPUModel(virQEMUCapsPtr qemuCaps,
|
||||
virCapsPtr caps,
|
||||
virArch hostArch,
|
||||
virDomainVirtType type);
|
||||
|
||||
int
|
||||
@ -94,7 +97,7 @@ virQEMUCapsSetCPUModelInfo(virQEMUCapsPtr qemuCaps,
|
||||
qemuMonitorCPUModelInfoPtr modelInfo);
|
||||
|
||||
virCPUDefPtr
|
||||
virQEMUCapsProbeHostCPUForEmulator(virCapsPtr caps,
|
||||
virQEMUCapsProbeHostCPUForEmulator(virArch hostArch,
|
||||
virQEMUCapsPtr qemuCaps,
|
||||
virDomainVirtType type) ATTRIBUTE_NOINLINE;
|
||||
|
||||
|
@ -2964,8 +2964,7 @@ qemuDomainDefPostParse(virDomainDefPtr def,
|
||||
if (qemuCaps) {
|
||||
virObjectRef(qemuCaps);
|
||||
} else {
|
||||
if (!(qemuCaps = virQEMUCapsCacheLookup(caps,
|
||||
driver->qemuCapsCache,
|
||||
if (!(qemuCaps = virQEMUCapsCacheLookup(driver->qemuCapsCache,
|
||||
def->emulator)))
|
||||
goto cleanup;
|
||||
}
|
||||
@ -3078,7 +3077,7 @@ qemuDomainDefValidateVideo(const virDomainDef *def)
|
||||
|
||||
static int
|
||||
qemuDomainDefValidate(const virDomainDef *def,
|
||||
virCapsPtr caps,
|
||||
virCapsPtr caps ATTRIBUTE_UNUSED,
|
||||
void *opaque)
|
||||
{
|
||||
virQEMUDriverPtr driver = opaque;
|
||||
@ -3086,8 +3085,7 @@ qemuDomainDefValidate(const virDomainDef *def,
|
||||
unsigned int topologycpus;
|
||||
int ret = -1;
|
||||
|
||||
if (!(qemuCaps = virQEMUCapsCacheLookup(caps,
|
||||
driver->qemuCapsCache,
|
||||
if (!(qemuCaps = virQEMUCapsCacheLookup(driver->qemuCapsCache,
|
||||
def->emulator)))
|
||||
goto cleanup;
|
||||
|
||||
@ -3549,7 +3547,7 @@ qemuDomainControllerDefPostParse(virDomainControllerDefPtr cont,
|
||||
static int
|
||||
qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
|
||||
const virDomainDef *def,
|
||||
virCapsPtr caps,
|
||||
virCapsPtr caps ATTRIBUTE_UNUSED,
|
||||
unsigned int parseFlags,
|
||||
void *opaque,
|
||||
void *parseOpaque)
|
||||
@ -3562,7 +3560,7 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
|
||||
if (qemuCaps) {
|
||||
virObjectRef(qemuCaps);
|
||||
} else {
|
||||
qemuCaps = virQEMUCapsCacheLookup(caps, driver->qemuCapsCache,
|
||||
qemuCaps = virQEMUCapsCacheLookup(driver->qemuCapsCache,
|
||||
def->emulator);
|
||||
}
|
||||
|
||||
@ -3682,7 +3680,7 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
|
||||
|
||||
static int
|
||||
qemuDomainDefAssignAddresses(virDomainDef *def,
|
||||
virCapsPtr caps,
|
||||
virCapsPtr caps ATTRIBUTE_UNUSED,
|
||||
unsigned int parseFlags ATTRIBUTE_UNUSED,
|
||||
void *opaque,
|
||||
void *parseOpaque)
|
||||
@ -3695,8 +3693,7 @@ qemuDomainDefAssignAddresses(virDomainDef *def,
|
||||
if (qemuCaps) {
|
||||
virObjectRef(qemuCaps);
|
||||
} else {
|
||||
if (!(qemuCaps = virQEMUCapsCacheLookup(caps,
|
||||
driver->qemuCapsCache,
|
||||
if (!(qemuCaps = virQEMUCapsCacheLookup(driver->qemuCapsCache,
|
||||
def->emulator)))
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -15929,7 +15929,7 @@ static virDomainPtr qemuDomainQemuAttach(virConnectPtr conn,
|
||||
virAsprintf(&def->name, "attach-pid-%u", pid_value) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (!(qemuCaps = virQEMUCapsCacheLookup(caps, driver->qemuCapsCache,
|
||||
if (!(qemuCaps = virQEMUCapsCacheLookup(driver->qemuCapsCache,
|
||||
def->emulator)))
|
||||
goto cleanup;
|
||||
|
||||
@ -18979,8 +18979,7 @@ qemuConnectGetDomainCapabilities(virConnectPtr conn,
|
||||
if (emulatorbin) {
|
||||
virArch arch_from_caps;
|
||||
|
||||
if (!(qemuCaps = virQEMUCapsCacheLookup(caps,
|
||||
driver->qemuCapsCache,
|
||||
if (!(qemuCaps = virQEMUCapsCacheLookup(driver->qemuCapsCache,
|
||||
emulatorbin)))
|
||||
goto cleanup;
|
||||
|
||||
@ -18999,8 +18998,7 @@ qemuConnectGetDomainCapabilities(virConnectPtr conn,
|
||||
goto cleanup;
|
||||
}
|
||||
} else {
|
||||
if (!(qemuCaps = virQEMUCapsCacheLookupByArch(caps,
|
||||
driver->qemuCapsCache,
|
||||
if (!(qemuCaps = virQEMUCapsCacheLookupByArch(driver->qemuCapsCache,
|
||||
arch)))
|
||||
goto cleanup;
|
||||
|
||||
|
@ -4693,8 +4693,7 @@ qemuProcessInit(virQEMUDriverPtr driver,
|
||||
|
||||
VIR_DEBUG("Determining emulator version");
|
||||
virObjectUnref(priv->qemuCaps);
|
||||
if (!(priv->qemuCaps = virQEMUCapsCacheLookupCopy(caps,
|
||||
driver->qemuCapsCache,
|
||||
if (!(priv->qemuCaps = virQEMUCapsCacheLookupCopy(driver->qemuCapsCache,
|
||||
vm->def->emulator,
|
||||
vm->def->os.machine)))
|
||||
goto cleanup;
|
||||
@ -6481,8 +6480,7 @@ int qemuProcessAttach(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
|
||||
VIR_DEBUG("Determining emulator version");
|
||||
virObjectUnref(priv->qemuCaps);
|
||||
if (!(priv->qemuCaps = virQEMUCapsCacheLookupCopy(caps,
|
||||
driver->qemuCapsCache,
|
||||
if (!(priv->qemuCaps = virQEMUCapsCacheLookupCopy(driver->qemuCapsCache,
|
||||
vm->def->emulator,
|
||||
vm->def->os.machine)))
|
||||
goto error;
|
||||
@ -6866,8 +6864,7 @@ qemuProcessReconnect(void *opaque)
|
||||
* caps in the domain status, so re-query them
|
||||
*/
|
||||
if (!priv->qemuCaps &&
|
||||
!(priv->qemuCaps = virQEMUCapsCacheLookupCopy(caps,
|
||||
driver->qemuCapsCache,
|
||||
!(priv->qemuCaps = virQEMUCapsCacheLookupCopy(driver->qemuCapsCache,
|
||||
obj->def->emulator,
|
||||
obj->def->os.machine)))
|
||||
goto error;
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include "testutils.h"
|
||||
#include "internal.h"
|
||||
#include "virarch.h"
|
||||
#include "virthread.h"
|
||||
#include "qemu/qemu_capabilities.h"
|
||||
#define __QEMU_CAPSPRIV_H_ALLOW__ 1
|
||||
@ -70,7 +71,7 @@ main(int argc, char **argv)
|
||||
if (virThreadCreate(&thread, false, eventLoop, NULL) < 0)
|
||||
return EXIT_FAILURE;
|
||||
|
||||
if (!(caps = virQEMUCapsNewForBinaryInternal(NULL, argv[1], "/tmp",
|
||||
if (!(caps = virQEMUCapsNewForBinaryInternal(VIR_ARCH_NONE, argv[1], "/tmp",
|
||||
-1, -1, true)))
|
||||
return EXIT_FAILURE;
|
||||
|
||||
|
@ -25,10 +25,11 @@
|
||||
#include "qemu/qemu_capspriv.h"
|
||||
#undef __QEMU_CAPSPRIV_H_ALLOW__
|
||||
#include "testutilshostcpus.h"
|
||||
#include "virarch.h"
|
||||
|
||||
|
||||
virCPUDefPtr
|
||||
virQEMUCapsProbeHostCPUForEmulator(virCapsPtr caps ATTRIBUTE_UNUSED,
|
||||
virQEMUCapsProbeHostCPUForEmulator(virArch hostArch ATTRIBUTE_UNUSED,
|
||||
virQEMUCapsPtr qemuCaps ATTRIBUTE_UNUSED,
|
||||
virDomainVirtType type ATTRIBUTE_UNUSED)
|
||||
{
|
||||
|
@ -377,6 +377,9 @@ testUpdateQEMUCaps(const struct testInfo *info,
|
||||
{
|
||||
int ret = -1;
|
||||
|
||||
if (!caps)
|
||||
goto cleanup;
|
||||
|
||||
virQEMUCapsSetArch(info->qemuCaps, vm->def->os.arch);
|
||||
|
||||
virQEMUCapsInitQMPBasicArch(info->qemuCaps);
|
||||
@ -389,8 +392,10 @@ testUpdateQEMUCaps(const struct testInfo *info,
|
||||
if (testAddCPUModels(info->qemuCaps, info->skipLegacyCPUs) < 0)
|
||||
goto cleanup;
|
||||
|
||||
virQEMUCapsInitHostCPUModel(info->qemuCaps, caps, VIR_DOMAIN_VIRT_KVM);
|
||||
virQEMUCapsInitHostCPUModel(info->qemuCaps, caps, VIR_DOMAIN_VIRT_QEMU);
|
||||
virQEMUCapsInitHostCPUModel(info->qemuCaps, caps->host.arch,
|
||||
VIR_DOMAIN_VIRT_KVM);
|
||||
virQEMUCapsInitHostCPUModel(info->qemuCaps, caps->host.arch,
|
||||
VIR_DOMAIN_VIRT_QEMU);
|
||||
|
||||
virQEMUCapsFilterByMachineType(info->qemuCaps, vm->def->os.machine);
|
||||
|
||||
|
@ -490,8 +490,11 @@ qemuTestParseCapabilities(virCapsPtr caps,
|
||||
{
|
||||
virQEMUCapsPtr qemuCaps = NULL;
|
||||
|
||||
if (!caps)
|
||||
return NULL;
|
||||
|
||||
if (!(qemuCaps = virQEMUCapsNew()) ||
|
||||
virQEMUCapsLoadCache(caps, qemuCaps, capsFile) < 0)
|
||||
virQEMUCapsLoadCache(caps->host.arch, qemuCaps, capsFile) < 0)
|
||||
goto error;
|
||||
|
||||
return qemuCaps;
|
||||
|
Loading…
Reference in New Issue
Block a user