qemuDomainSnapshotForEachQcow2Raw: Remove 'driver' argument

Now that it's unused except for the recursive call it can be dropped
from all of the call tree.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Peter Krempa 2024-11-11 17:17:04 +01:00
parent 20ffcb912f
commit 60838fee08
3 changed files with 17 additions and 29 deletions

View File

@ -5708,8 +5708,7 @@ qemuDomainSnapshotWriteMetadata(virDomainObj *vm,
/* The domain is expected to be locked and inactive. Return -1 on normal /* The domain is expected to be locked and inactive. Return -1 on normal
* failure, 1 if we skipped a disk due to try_all. */ * failure, 1 if we skipped a disk due to try_all. */
static int static int
qemuDomainSnapshotForEachQcow2Raw(virQEMUDriver *driver, qemuDomainSnapshotForEachQcow2Raw(virDomainDef *def,
virDomainDef *def,
virDomainMomentObj *snap, virDomainMomentObj *snap,
const char *op, const char *op,
bool try_all, bool try_all,
@ -5748,8 +5747,7 @@ qemuDomainSnapshotForEachQcow2Raw(virQEMUDriver *driver,
} else if (STREQ(op, "-c") && i) { } else if (STREQ(op, "-c") && i) {
/* We must roll back partial creation by deleting /* We must roll back partial creation by deleting
* all earlier snapshots. */ * all earlier snapshots. */
qemuDomainSnapshotForEachQcow2Raw(driver, def, snap, qemuDomainSnapshotForEachQcow2Raw(def, snap, "-d", false, i);
"-d", false, i);
} }
virReportError(VIR_ERR_OPERATION_INVALID, virReportError(VIR_ERR_OPERATION_INVALID,
_("Disk device '%1$s' does not support snapshotting"), _("Disk device '%1$s' does not support snapshotting"),
@ -5768,8 +5766,7 @@ qemuDomainSnapshotForEachQcow2Raw(virQEMUDriver *driver,
} else if (STREQ(op, "-c") && i) { } else if (STREQ(op, "-c") && i) {
/* We must roll back partial creation by deleting /* We must roll back partial creation by deleting
* all earlier snapshots. */ * all earlier snapshots. */
qemuDomainSnapshotForEachQcow2Raw(driver, def, snap, qemuDomainSnapshotForEachQcow2Raw(def, snap, "-d", false, i);
"-d", false, i);
} }
return -1; return -1;
} }
@ -5781,14 +5778,12 @@ qemuDomainSnapshotForEachQcow2Raw(virQEMUDriver *driver,
/* The domain is expected to be locked and inactive. Return -1 on normal /* The domain is expected to be locked and inactive. Return -1 on normal
* failure, 1 if we skipped a disk due to try_all. */ * failure, 1 if we skipped a disk due to try_all. */
int int
qemuDomainSnapshotForEachQcow2(virQEMUDriver *driver, qemuDomainSnapshotForEachQcow2(virDomainDef *def,
virDomainDef *def,
virDomainMomentObj *snap, virDomainMomentObj *snap,
const char *op, const char *op,
bool try_all) bool try_all)
{ {
return qemuDomainSnapshotForEachQcow2Raw(driver, def, snap, return qemuDomainSnapshotForEachQcow2Raw(def, snap, op, try_all, def->ndisks);
op, try_all, def->ndisks);
} }
/* Hash iterator callback to discard multiple snapshots. */ /* Hash iterator callback to discard multiple snapshots. */

View File

@ -670,8 +670,7 @@ int qemuDomainSnapshotWriteMetadata(virDomainObj *vm,
virDomainXMLOption *xmlopt, virDomainXMLOption *xmlopt,
const char *snapshotDir); const char *snapshotDir);
int qemuDomainSnapshotForEachQcow2(virQEMUDriver *driver, int qemuDomainSnapshotForEachQcow2(virDomainDef *def,
virDomainDef *def,
virDomainMomentObj *snap, virDomainMomentObj *snap,
const char *op, const char *op,
bool try_all); bool try_all);

View File

@ -251,11 +251,10 @@ qemuSnapshotCreateQcow2Files(virDomainDef *def,
/* The domain is expected to be locked and inactive. */ /* The domain is expected to be locked and inactive. */
static int static int
qemuSnapshotCreateInactiveInternal(virQEMUDriver *driver, qemuSnapshotCreateInactiveInternal(virDomainObj *vm,
virDomainObj *vm,
virDomainMomentObj *snap) virDomainMomentObj *snap)
{ {
return qemuDomainSnapshotForEachQcow2(driver, vm->def, snap, "-c", false); return qemuDomainSnapshotForEachQcow2(vm->def, snap, "-c", false);
} }
@ -1935,7 +1934,7 @@ qemuSnapshotCreate(virDomainObj *vm,
if (qemuSnapshotCreateInactiveExternal(driver, vm, snap, reuse) < 0) if (qemuSnapshotCreateInactiveExternal(driver, vm, snap, reuse) < 0)
goto error; goto error;
} else { } else {
if (qemuSnapshotCreateInactiveInternal(driver, vm, snap) < 0) if (qemuSnapshotCreateInactiveInternal(vm, snap) < 0)
goto error; goto error;
} }
} }
@ -2533,8 +2532,7 @@ qemuSnapshotRevertActive(virDomainObj *vm,
/* The domain is expected to be locked and inactive. */ /* The domain is expected to be locked and inactive. */
static int static int
qemuSnapshotInternalRevertInactive(virQEMUDriver *driver, qemuSnapshotInternalRevertInactive(virDomainObj *vm,
virDomainObj *vm,
virDomainMomentObj *snap) virDomainMomentObj *snap)
{ {
size_t i; size_t i;
@ -2553,7 +2551,7 @@ qemuSnapshotInternalRevertInactive(virQEMUDriver *driver,
} }
/* Try all disks, but report failure if we skipped any. */ /* Try all disks, but report failure if we skipped any. */
if (qemuDomainSnapshotForEachQcow2(driver, def, snap, "-a", true) != 0) if (qemuDomainSnapshotForEachQcow2(def, snap, "-a", true) != 0)
return -1; return -1;
return 0; return 0;
@ -2611,7 +2609,7 @@ qemuSnapshotRevertInactive(virDomainObj *vm,
qemuSnapshotRevertExternalFinish(vm, tmpsnapdef, snap); qemuSnapshotRevertExternalFinish(vm, tmpsnapdef, snap);
} else { } else {
if (qemuSnapshotInternalRevertInactive(driver, vm, snap) < 0) { if (qemuSnapshotInternalRevertInactive(vm, snap) < 0) {
qemuDomainRemoveInactive(driver, vm, 0, false); qemuDomainRemoveInactive(driver, vm, 0, false);
return -1; return -1;
} }
@ -3893,8 +3891,7 @@ qemuSnapshotDiscardActiveInternal(virDomainObj *vm,
/* Discard one snapshot (or its metadata), without reparenting any children. */ /* Discard one snapshot (or its metadata), without reparenting any children. */
static int static int
qemuSnapshotDiscardImpl(virQEMUDriver *driver, qemuSnapshotDiscardImpl(virDomainObj *vm,
virDomainObj *vm,
virDomainMomentObj *snap, virDomainMomentObj *snap,
GSList *externalData, GSList *externalData,
bool update_parent, bool update_parent,
@ -3922,7 +3919,7 @@ qemuSnapshotDiscardImpl(virQEMUDriver *driver,
if (qemuSnapshotDiscardExternal(vm, snap, externalData) < 0) if (qemuSnapshotDiscardExternal(vm, snap, externalData) < 0)
return -1; return -1;
} else { } else {
if (qemuDomainSnapshotForEachQcow2(driver, def, snap, "-d", true) < 0) if (qemuDomainSnapshotForEachQcow2(def, snap, "-d", true) < 0)
return -1; return -1;
} }
} else { } else {
@ -3961,13 +3958,13 @@ qemuSnapshotDiscardImpl(virQEMUDriver *driver,
static int static int
qemuSnapshotDiscard(virQEMUDriver *driver, qemuSnapshotDiscard(virQEMUDriver *driver G_GNUC_UNUSED,
virDomainObj *vm, virDomainObj *vm,
virDomainMomentObj *snap, virDomainMomentObj *snap,
bool update_parent, bool update_parent,
bool metadata_only) bool metadata_only)
{ {
return qemuSnapshotDiscardImpl(driver, vm, snap, NULL, update_parent, metadata_only); return qemuSnapshotDiscardImpl(vm, snap, NULL, update_parent, metadata_only);
} }
@ -3995,10 +3992,7 @@ qemuSnapshotDeleteSingle(virDomainObj *vm,
GSList *externalData, GSList *externalData,
bool metadata_only) bool metadata_only)
{ {
qemuDomainObjPrivate *priv = vm->privateData; return qemuSnapshotDiscardImpl(vm, snap, externalData, true, metadata_only);
virQEMUDriver *driver = priv->driver;
return qemuSnapshotDiscardImpl(driver, vm, snap, externalData, true, metadata_only);
} }