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