Now that the domain XML APIs don't use virCapsPtr we can stop passing it around many QEMU driver methods. Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx> --- src/qemu/qemu_checkpoint.c | 24 +++++++---------------- src/qemu/qemu_checkpoint.h | 1 - src/qemu/qemu_domain.c | 3 +-- src/qemu/qemu_domain.h | 1 - src/qemu/qemu_driver.c | 39 +++++++++----------------------------- src/qemu/qemu_process.c | 10 ---------- 6 files changed, 17 insertions(+), 61 deletions(-) diff --git a/src/qemu/qemu_checkpoint.c b/src/qemu/qemu_checkpoint.c index 2101932a28..30f65630ca 100644 --- a/src/qemu/qemu_checkpoint.c +++ b/src/qemu/qemu_checkpoint.c @@ -78,7 +78,6 @@ qemuCheckpointObjFromCheckpoint(virDomainObjPtr vm, static int qemuCheckpointWriteMetadata(virDomainObjPtr vm, virDomainMomentObjPtr checkpoint, - virCapsPtr caps G_GNUC_UNUSED, virDomainXMLOptionPtr xmlopt, const char *checkpointDir) { @@ -197,7 +196,7 @@ qemuCheckpointDiscard(virQEMUDriverPtr driver, virDomainCheckpointSetCurrent(vm->checkpoints, NULL); if (update_parent && parent) { virDomainCheckpointSetCurrent(vm->checkpoints, parent); - if (qemuCheckpointWriteMetadata(vm, parent, driver->caps, + if (qemuCheckpointWriteMetadata(vm, parent, driver->xmlopt, cfg->checkpointDir) < 0) { VIR_WARN("failed to set parent checkpoint '%s' as current", @@ -239,7 +238,6 @@ qemuCheckpointDiscardAllMetadata(virQEMUDriverPtr driver, /* Called inside job lock */ static int qemuCheckpointPrepare(virQEMUDriverPtr driver, - virCapsPtr caps G_GNUC_UNUSED, virDomainObjPtr vm, virDomainCheckpointDefPtr def) { @@ -373,7 +371,6 @@ qemuCheckpointRedefine(virQEMUDriverPtr driver, int qemuCheckpointCreateCommon(virQEMUDriverPtr driver, virDomainObjPtr vm, - virCapsPtr caps, virDomainCheckpointDefPtr *def, virJSONValuePtr *actions, virDomainMomentObjPtr *chk) @@ -381,7 +378,7 @@ qemuCheckpointCreateCommon(virQEMUDriverPtr driver, g_autoptr(virJSONValue) tmpactions = NULL; virDomainMomentObjPtr parent; - if (qemuCheckpointPrepare(driver, caps, vm, *def) < 0) + if (qemuCheckpointPrepare(driver, vm, *def) < 0) return -1; if ((parent = virDomainCheckpointGetCurrent(vm->checkpoints))) @@ -406,14 +403,13 @@ qemuCheckpointCreateCommon(virQEMUDriverPtr driver, static virDomainMomentObjPtr qemuCheckpointCreate(virQEMUDriverPtr driver, virDomainObjPtr vm, - virCapsPtr caps, virDomainCheckpointDefPtr *def) { g_autoptr(virJSONValue) actions = NULL; virDomainMomentObjPtr chk = NULL; int rc; - if (qemuCheckpointCreateCommon(driver, vm, caps, def, &actions, &chk) < 0) + if (qemuCheckpointCreateCommon(driver, vm, def, &actions, &chk) < 0) return NULL; qemuDomainObjEnterMonitor(driver, vm); @@ -437,7 +433,7 @@ qemuCheckpointCreateFinalize(virQEMUDriverPtr driver, if (update_current) virDomainCheckpointSetCurrent(vm->checkpoints, chk); - if (qemuCheckpointWriteMetadata(vm, chk, driver->caps, + if (qemuCheckpointWriteMetadata(vm, chk, driver->xmlopt, cfg->checkpointDir) < 0) { /* if writing of metadata fails, error out rather than trying @@ -469,7 +465,6 @@ qemuCheckpointCreateXML(virDomainPtr domain, bool redefine = flags & VIR_DOMAIN_CHECKPOINT_CREATE_REDEFINE; unsigned int parse_flags = 0; g_autoptr(virQEMUDriverConfig) cfg = NULL; - g_autoptr(virCaps) caps = NULL; g_autoptr(virDomainCheckpointDef) def = NULL; virCheckFlags(VIR_DOMAIN_CHECKPOINT_CREATE_REDEFINE, NULL); @@ -485,9 +480,6 @@ qemuCheckpointCreateXML(virDomainPtr domain, return NULL; } - if (!(caps = virQEMUDriverGetCapabilities(driver, false))) - return NULL; - if (!virDomainObjIsActive(vm)) { virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", _("cannot create checkpoint for inactive domain")); @@ -506,7 +498,7 @@ qemuCheckpointCreateXML(virDomainPtr domain, if (redefine) { chk = qemuCheckpointRedefine(driver, vm, &def, &update_current); } else { - chk = qemuCheckpointCreate(driver, vm, caps, &def); + chk = qemuCheckpointCreate(driver, vm, &def); } if (!chk) @@ -557,7 +549,6 @@ struct virQEMUCheckpointReparent { const char *dir; virDomainMomentObjPtr parent; virDomainObjPtr vm; - virCapsPtr caps; virDomainXMLOptionPtr xmlopt; int err; }; @@ -579,7 +570,7 @@ qemuCheckpointReparentChildren(void *payload, if (rep->parent->def) moment->def->parent_name = g_strdup(rep->parent->def->name); - rep->err = qemuCheckpointWriteMetadata(rep->vm, moment, rep->caps, + rep->err = qemuCheckpointWriteMetadata(rep->vm, moment, rep->xmlopt, rep->dir); return 0; } @@ -639,7 +630,7 @@ qemuCheckpointDelete(virDomainObjPtr vm, if (rem.found) { virDomainCheckpointSetCurrent(vm->checkpoints, chk); if (flags & VIR_DOMAIN_CHECKPOINT_DELETE_CHILDREN_ONLY) { - if (qemuCheckpointWriteMetadata(vm, chk, driver->caps, + if (qemuCheckpointWriteMetadata(vm, chk, driver->xmlopt, cfg->checkpointDir) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, @@ -655,7 +646,6 @@ qemuCheckpointDelete(virDomainObjPtr vm, rep.parent = chk->parent; rep.vm = vm; rep.err = 0; - rep.caps = driver->caps; rep.xmlopt = driver->xmlopt; virDomainMomentForEachChild(chk, qemuCheckpointReparentChildren, &rep); diff --git a/src/qemu/qemu_checkpoint.h b/src/qemu/qemu_checkpoint.h index d0ea8f000f..00548beec9 100644 --- a/src/qemu/qemu_checkpoint.h +++ b/src/qemu/qemu_checkpoint.h @@ -57,7 +57,6 @@ qemuCheckpointDelete(virDomainObjPtr vm, int qemuCheckpointCreateCommon(virQEMUDriverPtr driver, virDomainObjPtr vm, - virCapsPtr caps, virDomainCheckpointDefPtr *def, virJSONValuePtr *actions, virDomainMomentObjPtr *chk); diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 594c4d5400..84813ded40 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -9714,7 +9714,6 @@ qemuFindQemuImgBinary(virQEMUDriverPtr driver) int qemuDomainSnapshotWriteMetadata(virDomainObjPtr vm, virDomainMomentObjPtr snapshot, - virCapsPtr caps G_GNUC_UNUSED, virDomainXMLOptionPtr xmlopt, const char *snapshotDir) { @@ -9887,7 +9886,7 @@ qemuDomainSnapshotDiscard(virQEMUDriverPtr driver, snap->def->parent_name); } else { virDomainSnapshotSetCurrent(vm->snapshots, parentsnap); - if (qemuDomainSnapshotWriteMetadata(vm, parentsnap, driver->caps, + if (qemuDomainSnapshotWriteMetadata(vm, parentsnap, driver->xmlopt, cfg->snapshotDir) < 0) { VIR_WARN("failed to set parent snapshot '%s' as current", diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index f626d3a54c..3bbb0b2e44 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -763,7 +763,6 @@ const char *qemuFindQemuImgBinary(virQEMUDriverPtr driver); int qemuDomainSnapshotWriteMetadata(virDomainObjPtr vm, virDomainMomentObjPtr snapshot, - virCapsPtr caps, virDomainXMLOptionPtr xmlopt, const char *snapshotDir); diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index b544bed7c1..ae6facc829 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -8063,7 +8063,6 @@ qemuCheckDiskConfigAgainstDomain(const virDomainDef *def, static int qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef, virDomainDeviceDefPtr dev, - virCapsPtr caps G_GNUC_UNUSED, virQEMUCapsPtr qemuCaps, unsigned int parse_flags, virDomainXMLOptionPtr xmlopt) @@ -8273,7 +8272,6 @@ qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef, static int qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef, virDomainDeviceDefPtr dev, - virCapsPtr caps G_GNUC_UNUSED, virQEMUCapsPtr qemuCaps, unsigned int parse_flags, virDomainXMLOptionPtr xmlopt) @@ -8465,7 +8463,6 @@ qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef, static int qemuDomainUpdateDeviceConfig(virDomainDefPtr vmdef, virDomainDeviceDefPtr dev, - virCapsPtr caps G_GNUC_UNUSED, virQEMUCapsPtr qemuCaps, unsigned int parse_flags, virDomainXMLOptionPtr xmlopt) @@ -8582,7 +8579,6 @@ qemuDomainAttachDeviceLiveAndConfig(virDomainObjPtr vm, virDomainDeviceDefPtr devConf = NULL; virDomainDeviceDefPtr devLive = NULL; int ret = -1; - g_autoptr(virCaps) caps = NULL; unsigned int parse_flags = VIR_DOMAIN_DEF_PARSE_INACTIVE | VIR_DOMAIN_DEF_PARSE_ABI_UPDATE; @@ -8591,9 +8587,6 @@ qemuDomainAttachDeviceLiveAndConfig(virDomainObjPtr vm, cfg = virQEMUDriverGetConfig(driver); - if (!(caps = virQEMUDriverGetCapabilities(driver, false))) - goto cleanup; - /* The config and live post processing address auto-generation algorithms * rely on the correct vm->def or vm->newDef being passed, so call the * device parse based on which definition is in use */ @@ -8617,7 +8610,7 @@ qemuDomainAttachDeviceLiveAndConfig(virDomainObjPtr vm, false) < 0) goto cleanup; - if (qemuDomainAttachDeviceConfig(vmdef, devConf, caps, priv->qemuCaps, + if (qemuDomainAttachDeviceConfig(vmdef, devConf, priv->qemuCaps, parse_flags, driver->xmlopt) < 0) goto cleanup; @@ -8723,7 +8716,6 @@ static int qemuDomainUpdateDeviceFlags(virDomainPtr dom, bool force = (flags & VIR_DOMAIN_DEVICE_MODIFY_FORCE) != 0; int ret = -1; g_autoptr(virQEMUDriverConfig) cfg = NULL; - g_autoptr(virCaps) caps = NULL; unsigned int parse_flags = 0; virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | @@ -8734,9 +8726,6 @@ static int qemuDomainUpdateDeviceFlags(virDomainPtr dom, cfg = virQEMUDriverGetConfig(driver); - if (!(caps = virQEMUDriverGetCapabilities(driver, false))) - goto cleanup; - if (!(vm = qemuDomainObjFromDomain(dom))) goto cleanup; @@ -8782,7 +8771,7 @@ static int qemuDomainUpdateDeviceFlags(virDomainPtr dom, /* virDomainDefCompatibleDevice call is delayed until we know the * device we're going to update. */ - if ((ret = qemuDomainUpdateDeviceConfig(vmdef, dev, caps, priv->qemuCaps, + if ((ret = qemuDomainUpdateDeviceConfig(vmdef, dev, priv->qemuCaps, parse_flags, driver->xmlopt)) < 0) goto endjob; @@ -8833,7 +8822,6 @@ qemuDomainDetachDeviceLiveAndConfig(virQEMUDriverPtr driver, unsigned int flags) { qemuDomainObjPrivatePtr priv = vm->privateData; - g_autoptr(virCaps) caps = NULL; g_autoptr(virQEMUDriverConfig) cfg = NULL; virDomainDeviceDefPtr dev = NULL, dev_copy = NULL; unsigned int parse_flags = VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE; @@ -8843,9 +8831,6 @@ qemuDomainDetachDeviceLiveAndConfig(virQEMUDriverPtr driver, virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG, -1); - if (!(caps = virQEMUDriverGetCapabilities(driver, false))) - goto cleanup; - cfg = virQEMUDriverGetConfig(driver); if ((flags & VIR_DOMAIN_AFFECT_CONFIG) && @@ -8876,7 +8861,7 @@ qemuDomainDetachDeviceLiveAndConfig(virQEMUDriverPtr driver, if (!vmdef) goto cleanup; - if (qemuDomainDetachDeviceConfig(vmdef, dev, caps, priv->qemuCaps, + if (qemuDomainDetachDeviceConfig(vmdef, dev, priv->qemuCaps, parse_flags, driver->xmlopt) < 0) goto cleanup; @@ -8927,7 +8912,6 @@ qemuDomainDetachDeviceAliasLiveAndConfig(virQEMUDriverPtr driver, unsigned int flags) { qemuDomainObjPrivatePtr priv = vm->privateData; - g_autoptr(virCaps) caps = NULL; g_autoptr(virQEMUDriverConfig) cfg = NULL; virDomainDefPtr def = NULL; virDomainDefPtr persistentDef = NULL; @@ -8938,9 +8922,6 @@ qemuDomainDetachDeviceAliasLiveAndConfig(virQEMUDriverPtr driver, virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG, -1); - if (!(caps = virQEMUDriverGetCapabilities(driver, false))) - goto cleanup; - cfg = virQEMUDriverGetConfig(driver); if ((flags & VIR_DOMAIN_AFFECT_CONFIG) && @@ -8960,7 +8941,7 @@ qemuDomainDetachDeviceAliasLiveAndConfig(virQEMUDriverPtr driver, if (virDomainDefFindDevice(vmdef, alias, &dev, true) < 0) goto cleanup; - if (qemuDomainDetachDeviceConfig(vmdef, &dev, caps, priv->qemuCaps, + if (qemuDomainDetachDeviceConfig(vmdef, &dev, priv->qemuCaps, parse_flags, driver->xmlopt) < 0) goto cleanup; } @@ -15987,7 +15968,7 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain, if (snapshot && !(flags & VIR_DOMAIN_SNAPSHOT_CREATE_NO_METADATA)) { if (update_current) virDomainSnapshotSetCurrent(vm->snapshots, snap); - if (qemuDomainSnapshotWriteMetadata(vm, snap, driver->caps, + if (qemuDomainSnapshotWriteMetadata(vm, snap, driver->xmlopt, cfg->snapshotDir) < 0) { /* if writing of metadata fails, error out rather than trying @@ -16813,7 +16794,7 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, cleanup: if (ret == 0) { virDomainSnapshotSetCurrent(vm->snapshots, snap); - if (qemuDomainSnapshotWriteMetadata(vm, snap, driver->caps, + if (qemuDomainSnapshotWriteMetadata(vm, snap, driver->xmlopt, cfg->snapshotDir) < 0) { virDomainSnapshotSetCurrent(vm->snapshots, NULL); @@ -16847,11 +16828,10 @@ struct _virQEMUMomentReparent { const char *dir; virDomainMomentObjPtr parent; virDomainObjPtr vm; - virCapsPtr caps; virDomainXMLOptionPtr xmlopt; int err; int (*writeMetadata)(virDomainObjPtr, virDomainMomentObjPtr, - virCapsPtr, virDomainXMLOptionPtr, const char *); + virDomainXMLOptionPtr, const char *); }; @@ -16871,7 +16851,7 @@ qemuDomainMomentReparentChildren(void *payload, if (rep->parent->def) moment->def->parent_name = g_strdup(rep->parent->def->name); - rep->err = rep->writeMetadata(rep->vm, moment, rep->caps, rep->xmlopt, + rep->err = rep->writeMetadata(rep->vm, moment, rep->xmlopt, rep->dir); return 0; } @@ -16942,7 +16922,7 @@ qemuDomainSnapshotDelete(virDomainSnapshotPtr snapshot, if (rem.found) { virDomainSnapshotSetCurrent(vm->snapshots, snap); if (flags & VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN_ONLY) { - if (qemuDomainSnapshotWriteMetadata(vm, snap, driver->caps, + if (qemuDomainSnapshotWriteMetadata(vm, snap, driver->xmlopt, cfg->snapshotDir) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, @@ -16958,7 +16938,6 @@ qemuDomainSnapshotDelete(virDomainSnapshotPtr snapshot, rep.parent = snap->parent; rep.vm = vm; rep.err = 0; - rep.caps = driver->caps; rep.xmlopt = driver->xmlopt; rep.writeMetadata = qemuDomainSnapshotWriteMetadata; virDomainMomentForEachChild(snap, diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 7a0cbc109f..4287ed0830 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -6725,7 +6725,6 @@ qemuProcessLaunch(virConnectPtr conn, virCommandPtr cmd = NULL; struct qemuProcessHookData hookData; virQEMUDriverConfigPtr cfg; - virCapsPtr caps = NULL; size_t nnicindexes = 0; int *nicindexes = NULL; size_t i; @@ -6762,9 +6761,6 @@ qemuProcessLaunch(virConnectPtr conn, /* We don't increase cfg's reference counter here. */ hookData.cfg = cfg; - if (!(caps = virQEMUDriverGetCapabilities(driver, false))) - goto cleanup; - VIR_DEBUG("Creating domain log file"); if (!(logCtxt = qemuDomainLogContextNew(driver, vm, QEMU_DOMAIN_LOG_CONTEXT_MODE_START))) { @@ -7042,7 +7038,6 @@ qemuProcessLaunch(virConnectPtr conn, virCommandFree(cmd); virObjectUnref(logCtxt); virObjectUnref(cfg); - virObjectUnref(caps); VIR_FREE(nicindexes); return ret; } @@ -8007,7 +8002,6 @@ qemuProcessReconnect(void *opaque) size_t i; unsigned int stopFlags = 0; bool jobStarted = false; - virCapsPtr caps = NULL; bool retry = true; bool tryMonReconn = false; @@ -8022,9 +8016,6 @@ qemuProcessReconnect(void *opaque) cfg = virQEMUDriverGetConfig(driver); priv = obj->privateData; - if (!(caps = virQEMUDriverGetCapabilities(driver, false))) - goto error; - if (qemuDomainObjBeginJob(driver, obj, QEMU_JOB_MODIFY) < 0) goto error; jobStarted = true; @@ -8255,7 +8246,6 @@ qemuProcessReconnect(void *opaque) } virDomainObjEndAPI(&obj); virObjectUnref(cfg); - virObjectUnref(caps); virNWFilterUnlockFilterUpdates(); virIdentitySetCurrent(NULL); return; -- 2.23.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list