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

View File

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

View File

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