mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 11:31:16 +00:00
qemu: Propagate virCapsPtr to virQEMUCapsNewForBinaryInternal
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
parent
85105b0a4c
commit
b27adaed37
@ -843,7 +843,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(cache, binary))) {
|
if (!(qemubinCaps = virQEMUCapsCacheLookup(caps, cache, binary))) {
|
||||||
virResetLastError();
|
virResetLastError();
|
||||||
VIR_FREE(binary);
|
VIR_FREE(binary);
|
||||||
}
|
}
|
||||||
@ -883,7 +883,7 @@ virQEMUCapsInitGuest(virCapsPtr caps,
|
|||||||
if (!kvmbin)
|
if (!kvmbin)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!(kvmbinCaps = virQEMUCapsCacheLookup(cache, kvmbin))) {
|
if (!(kvmbinCaps = virQEMUCapsCacheLookup(caps, cache, kvmbin))) {
|
||||||
virResetLastError();
|
virResetLastError();
|
||||||
VIR_FREE(kvmbin);
|
VIR_FREE(kvmbin);
|
||||||
continue;
|
continue;
|
||||||
@ -2047,7 +2047,7 @@ int virQEMUCapsGetDefaultVersion(virCapsPtr caps,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
qemucaps = virQEMUCapsCacheLookup(capsCache, capsdata->emulator);
|
qemucaps = virQEMUCapsCacheLookup(caps, capsCache, capsdata->emulator);
|
||||||
VIR_FREE(capsdata);
|
VIR_FREE(capsdata);
|
||||||
if (!qemucaps)
|
if (!qemucaps)
|
||||||
return -1;
|
return -1;
|
||||||
@ -3871,7 +3871,8 @@ virQEMUCapsLogProbeFailure(const char *binary)
|
|||||||
|
|
||||||
|
|
||||||
virQEMUCapsPtr
|
virQEMUCapsPtr
|
||||||
virQEMUCapsNewForBinaryInternal(const char *binary,
|
virQEMUCapsNewForBinaryInternal(virCapsPtr caps ATTRIBUTE_UNUSED,
|
||||||
|
const char *binary,
|
||||||
const char *libDir,
|
const char *libDir,
|
||||||
const char *cacheDir,
|
const char *cacheDir,
|
||||||
uid_t runUid,
|
uid_t runUid,
|
||||||
@ -3949,13 +3950,14 @@ virQEMUCapsNewForBinaryInternal(const char *binary,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static virQEMUCapsPtr
|
static virQEMUCapsPtr
|
||||||
virQEMUCapsNewForBinary(const char *binary,
|
virQEMUCapsNewForBinary(virCapsPtr caps,
|
||||||
|
const char *binary,
|
||||||
const char *libDir,
|
const char *libDir,
|
||||||
const char *cacheDir,
|
const char *cacheDir,
|
||||||
uid_t runUid,
|
uid_t runUid,
|
||||||
gid_t runGid)
|
gid_t runGid)
|
||||||
{
|
{
|
||||||
return virQEMUCapsNewForBinaryInternal(binary, libDir, cacheDir,
|
return virQEMUCapsNewForBinaryInternal(caps, binary, libDir, cacheDir,
|
||||||
runUid, runGid, false);
|
runUid, runGid, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4050,7 +4052,9 @@ virQEMUCapsCacheNew(const char *libDir,
|
|||||||
const char *qemuTestCapsName;
|
const char *qemuTestCapsName;
|
||||||
|
|
||||||
virQEMUCapsPtr
|
virQEMUCapsPtr
|
||||||
virQEMUCapsCacheLookup(virQEMUCapsCachePtr cache, const char *binary)
|
virQEMUCapsCacheLookup(virCapsPtr caps,
|
||||||
|
virQEMUCapsCachePtr cache,
|
||||||
|
const char *binary)
|
||||||
{
|
{
|
||||||
virQEMUCapsPtr ret = NULL;
|
virQEMUCapsPtr ret = NULL;
|
||||||
|
|
||||||
@ -4070,7 +4074,7 @@ virQEMUCapsCacheLookup(virQEMUCapsCachePtr cache, const char *binary)
|
|||||||
if (!ret) {
|
if (!ret) {
|
||||||
VIR_DEBUG("Creating capabilities for %s",
|
VIR_DEBUG("Creating capabilities for %s",
|
||||||
binary);
|
binary);
|
||||||
ret = virQEMUCapsNewForBinary(binary, cache->libDir,
|
ret = virQEMUCapsNewForBinary(caps, binary, cache->libDir,
|
||||||
cache->cacheDir,
|
cache->cacheDir,
|
||||||
cache->runUid, cache->runGid);
|
cache->runUid, cache->runGid);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
@ -4090,11 +4094,12 @@ virQEMUCapsCacheLookup(virQEMUCapsCachePtr cache, const char *binary)
|
|||||||
|
|
||||||
|
|
||||||
virQEMUCapsPtr
|
virQEMUCapsPtr
|
||||||
virQEMUCapsCacheLookupCopy(virQEMUCapsCachePtr cache,
|
virQEMUCapsCacheLookupCopy(virCapsPtr caps,
|
||||||
|
virQEMUCapsCachePtr cache,
|
||||||
const char *binary,
|
const char *binary,
|
||||||
const char *machineType)
|
const char *machineType)
|
||||||
{
|
{
|
||||||
virQEMUCapsPtr qemuCaps = virQEMUCapsCacheLookup(cache, binary);
|
virQEMUCapsPtr qemuCaps = virQEMUCapsCacheLookup(caps, cache, binary);
|
||||||
virQEMUCapsPtr ret;
|
virQEMUCapsPtr ret;
|
||||||
|
|
||||||
if (!qemuCaps)
|
if (!qemuCaps)
|
||||||
|
@ -452,9 +452,11 @@ void virQEMUCapsSetGICCapabilities(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(virQEMUCapsCachePtr cache,
|
virQEMUCapsPtr virQEMUCapsCacheLookup(virCapsPtr caps,
|
||||||
|
virQEMUCapsCachePtr cache,
|
||||||
const char *binary);
|
const char *binary);
|
||||||
virQEMUCapsPtr virQEMUCapsCacheLookupCopy(virQEMUCapsCachePtr cache,
|
virQEMUCapsPtr virQEMUCapsCacheLookupCopy(virCapsPtr caps,
|
||||||
|
virQEMUCapsCachePtr cache,
|
||||||
const char *binary,
|
const char *binary,
|
||||||
const char *machineType);
|
const char *machineType);
|
||||||
virQEMUCapsPtr virQEMUCapsCacheLookupByArch(virQEMUCapsCachePtr cache,
|
virQEMUCapsPtr virQEMUCapsCacheLookupByArch(virQEMUCapsCachePtr cache,
|
||||||
|
@ -40,7 +40,8 @@ struct _virQEMUCapsCache {
|
|||||||
virQEMUCapsPtr virQEMUCapsNewCopy(virQEMUCapsPtr qemuCaps);
|
virQEMUCapsPtr virQEMUCapsNewCopy(virQEMUCapsPtr qemuCaps);
|
||||||
|
|
||||||
virQEMUCapsPtr
|
virQEMUCapsPtr
|
||||||
virQEMUCapsNewForBinaryInternal(const char *binary,
|
virQEMUCapsNewForBinaryInternal(virCapsPtr caps,
|
||||||
|
const char *binary,
|
||||||
const char *libDir,
|
const char *libDir,
|
||||||
const char *cacheDir,
|
const char *cacheDir,
|
||||||
uid_t runUid,
|
uid_t runUid,
|
||||||
|
@ -2359,7 +2359,8 @@ qemuDomainDefPostParse(virDomainDefPtr def,
|
|||||||
!(def->emulator = virDomainDefGetDefaultEmulator(def, caps)))
|
!(def->emulator = virDomainDefGetDefaultEmulator(def, caps)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (!(qemuCaps = virQEMUCapsCacheLookup(driver->qemuCapsCache,
|
if (!(qemuCaps = virQEMUCapsCacheLookup(caps,
|
||||||
|
driver->qemuCapsCache,
|
||||||
def->emulator)))
|
def->emulator)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
@ -2390,7 +2391,7 @@ qemuDomainDefPostParse(virDomainDefPtr def,
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
qemuDomainDefValidate(const virDomainDef *def,
|
qemuDomainDefValidate(const virDomainDef *def,
|
||||||
virCapsPtr caps ATTRIBUTE_UNUSED,
|
virCapsPtr caps,
|
||||||
void *opaque)
|
void *opaque)
|
||||||
{
|
{
|
||||||
virQEMUDriverPtr driver = opaque;
|
virQEMUDriverPtr driver = opaque;
|
||||||
@ -2398,7 +2399,8 @@ qemuDomainDefValidate(const virDomainDef *def,
|
|||||||
size_t topologycpus;
|
size_t topologycpus;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
if (!(qemuCaps = virQEMUCapsCacheLookup(driver->qemuCapsCache,
|
if (!(qemuCaps = virQEMUCapsCacheLookup(caps,
|
||||||
|
driver->qemuCapsCache,
|
||||||
def->emulator)))
|
def->emulator)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
@ -2552,7 +2554,7 @@ qemuDomainChrDefDropDefaultPath(virDomainChrDefPtr chr,
|
|||||||
static int
|
static int
|
||||||
qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
|
qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
|
||||||
const virDomainDef *def,
|
const virDomainDef *def,
|
||||||
virCapsPtr caps ATTRIBUTE_UNUSED,
|
virCapsPtr caps,
|
||||||
unsigned int parseFlags,
|
unsigned int parseFlags,
|
||||||
void *opaque)
|
void *opaque)
|
||||||
{
|
{
|
||||||
@ -2561,7 +2563,8 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
|
|||||||
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
|
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
qemuCaps = virQEMUCapsCacheLookup(driver->qemuCapsCache, def->emulator);
|
qemuCaps = virQEMUCapsCacheLookup(caps, driver->qemuCapsCache,
|
||||||
|
def->emulator);
|
||||||
|
|
||||||
if (dev->type == VIR_DOMAIN_DEVICE_NET &&
|
if (dev->type == VIR_DOMAIN_DEVICE_NET &&
|
||||||
dev->data.net->type != VIR_DOMAIN_NET_TYPE_HOSTDEV &&
|
dev->data.net->type != VIR_DOMAIN_NET_TYPE_HOSTDEV &&
|
||||||
@ -2758,7 +2761,7 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
qemuDomainDefAssignAddresses(virDomainDef *def,
|
qemuDomainDefAssignAddresses(virDomainDef *def,
|
||||||
virCapsPtr caps ATTRIBUTE_UNUSED,
|
virCapsPtr caps,
|
||||||
unsigned int parseFlags ATTRIBUTE_UNUSED,
|
unsigned int parseFlags ATTRIBUTE_UNUSED,
|
||||||
void *opaque)
|
void *opaque)
|
||||||
{
|
{
|
||||||
@ -2767,7 +2770,8 @@ qemuDomainDefAssignAddresses(virDomainDef *def,
|
|||||||
int ret = -1;
|
int ret = -1;
|
||||||
bool newDomain = parseFlags & VIR_DOMAIN_DEF_PARSE_ABI_UPDATE;
|
bool newDomain = parseFlags & VIR_DOMAIN_DEF_PARSE_ABI_UPDATE;
|
||||||
|
|
||||||
if (!(qemuCaps = virQEMUCapsCacheLookup(driver->qemuCapsCache,
|
if (!(qemuCaps = virQEMUCapsCacheLookup(caps,
|
||||||
|
driver->qemuCapsCache,
|
||||||
def->emulator)))
|
def->emulator)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
@ -8376,7 +8376,8 @@ static int qemuDomainUpdateDeviceFlags(virDomainPtr dom,
|
|||||||
|
|
||||||
if (priv->qemuCaps)
|
if (priv->qemuCaps)
|
||||||
qemuCaps = virObjectRef(priv->qemuCaps);
|
qemuCaps = virObjectRef(priv->qemuCaps);
|
||||||
else if (!(qemuCaps = virQEMUCapsCacheLookup(driver->qemuCapsCache, vm->def->emulator)))
|
else if (!(qemuCaps = virQEMUCapsCacheLookup(caps, driver->qemuCapsCache,
|
||||||
|
vm->def->emulator)))
|
||||||
goto endjob;
|
goto endjob;
|
||||||
|
|
||||||
if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
|
if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
|
||||||
@ -15745,7 +15746,8 @@ 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(driver->qemuCapsCache, def->emulator)))
|
if (!(qemuCaps = virQEMUCapsCacheLookup(caps, driver->qemuCapsCache,
|
||||||
|
def->emulator)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (qemuAssignDeviceAliases(def, qemuCaps) < 0)
|
if (qemuAssignDeviceAliases(def, qemuCaps) < 0)
|
||||||
@ -18673,7 +18675,8 @@ qemuConnectGetDomainCapabilities(virConnectPtr conn,
|
|||||||
if (emulatorbin) {
|
if (emulatorbin) {
|
||||||
virArch arch_from_caps;
|
virArch arch_from_caps;
|
||||||
|
|
||||||
if (!(qemuCaps = virQEMUCapsCacheLookup(driver->qemuCapsCache,
|
if (!(qemuCaps = virQEMUCapsCacheLookup(caps,
|
||||||
|
driver->qemuCapsCache,
|
||||||
emulatorbin)))
|
emulatorbin)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
@ -3248,6 +3248,7 @@ qemuProcessReconnect(void *opaque)
|
|||||||
int ret;
|
int ret;
|
||||||
unsigned int stopFlags = 0;
|
unsigned int stopFlags = 0;
|
||||||
bool jobStarted = false;
|
bool jobStarted = false;
|
||||||
|
virCapsPtr caps = NULL;
|
||||||
|
|
||||||
VIR_FREE(data);
|
VIR_FREE(data);
|
||||||
|
|
||||||
@ -3258,6 +3259,9 @@ qemuProcessReconnect(void *opaque)
|
|||||||
cfg = virQEMUDriverGetConfig(driver);
|
cfg = virQEMUDriverGetConfig(driver);
|
||||||
priv = obj->privateData;
|
priv = obj->privateData;
|
||||||
|
|
||||||
|
if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
|
||||||
|
goto error;
|
||||||
|
|
||||||
if (qemuDomainObjBeginJob(driver, obj, QEMU_JOB_MODIFY) < 0)
|
if (qemuDomainObjBeginJob(driver, obj, QEMU_JOB_MODIFY) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
jobStarted = true;
|
jobStarted = true;
|
||||||
@ -3327,7 +3331,8 @@ 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(driver->qemuCapsCache,
|
!(priv->qemuCaps = virQEMUCapsCacheLookupCopy(caps,
|
||||||
|
driver->qemuCapsCache,
|
||||||
obj->def->emulator,
|
obj->def->emulator,
|
||||||
obj->def->os.machine)))
|
obj->def->os.machine)))
|
||||||
goto error;
|
goto error;
|
||||||
@ -3427,6 +3432,7 @@ qemuProcessReconnect(void *opaque)
|
|||||||
virDomainObjEndAPI(&obj);
|
virDomainObjEndAPI(&obj);
|
||||||
virObjectUnref(conn);
|
virObjectUnref(conn);
|
||||||
virObjectUnref(cfg);
|
virObjectUnref(cfg);
|
||||||
|
virObjectUnref(caps);
|
||||||
virNWFilterUnlockFilterUpdates();
|
virNWFilterUnlockFilterUpdates();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -4664,7 +4670,8 @@ qemuProcessInit(virQEMUDriverPtr driver,
|
|||||||
|
|
||||||
VIR_DEBUG("Determining emulator version");
|
VIR_DEBUG("Determining emulator version");
|
||||||
virObjectUnref(priv->qemuCaps);
|
virObjectUnref(priv->qemuCaps);
|
||||||
if (!(priv->qemuCaps = virQEMUCapsCacheLookupCopy(driver->qemuCapsCache,
|
if (!(priv->qemuCaps = virQEMUCapsCacheLookupCopy(caps,
|
||||||
|
driver->qemuCapsCache,
|
||||||
vm->def->emulator,
|
vm->def->emulator,
|
||||||
vm->def->os.machine)))
|
vm->def->os.machine)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -6282,7 +6289,8 @@ 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(driver->qemuCapsCache,
|
if (!(priv->qemuCaps = virQEMUCapsCacheLookupCopy(caps,
|
||||||
|
driver->qemuCapsCache,
|
||||||
vm->def->emulator,
|
vm->def->emulator,
|
||||||
vm->def->os.machine)))
|
vm->def->os.machine)))
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -70,7 +70,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(argv[1], "/tmp", NULL,
|
if (!(caps = virQEMUCapsNewForBinaryInternal(NULL, argv[1], "/tmp", NULL,
|
||||||
-1, -1, true)))
|
-1, -1, true)))
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user