qemuSnapshotDiskUpdateSource: Extract 'driver' and 'blockdev' from 'vm'

Reduce the number of arguments by taking them from 'vm'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2020-09-21 12:21:09 +02:00
parent 8eacbeac74
commit eb4aa7b109

View File

@ -1103,19 +1103,18 @@ qemuSnapshotDiskUpdateSourceRenumber(virStorageSourcePtr src)
/** /**
* qemuSnapshotDiskUpdateSource: * qemuSnapshotDiskUpdateSource:
* @driver: QEMU driver
* @vm: domain object * @vm: domain object
* @dd: snapshot disk data object * @dd: snapshot disk data object
* @blockdev: -blockdev is in use for the VM
* *
* Updates disk definition after a successful snapshot. * Updates disk definition after a successful snapshot.
*/ */
static void static void
qemuSnapshotDiskUpdateSource(virQEMUDriverPtr driver, qemuSnapshotDiskUpdateSource(virDomainObjPtr vm,
virDomainObjPtr vm, qemuSnapshotDiskDataPtr dd)
qemuSnapshotDiskDataPtr dd,
bool blockdev)
{ {
qemuDomainObjPrivatePtr priv = vm->privateData;
virQEMUDriverPtr driver = priv->driver;
/* storage driver access won'd be needed */ /* storage driver access won'd be needed */
if (dd->initialized) if (dd->initialized)
virStorageFileDeinit(dd->src); virStorageFileDeinit(dd->src);
@ -1138,7 +1137,7 @@ qemuSnapshotDiskUpdateSource(virQEMUDriverPtr driver,
dd->disk->src = g_steal_pointer(&dd->src); dd->disk->src = g_steal_pointer(&dd->src);
/* fix numbering of disks */ /* fix numbering of disks */
if (!blockdev) if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV))
qemuSnapshotDiskUpdateSourceRenumber(dd->disk->src); qemuSnapshotDiskUpdateSourceRenumber(dd->disk->src);
if (dd->persistdisk) { if (dd->persistdisk) {
@ -1201,7 +1200,7 @@ qemuSnapshotCreateActiveExternalDisks(virQEMUDriverPtr driver,
virDomainAuditDisk(vm, dd->disk->src, dd->src, "snapshot", rc >= 0); virDomainAuditDisk(vm, dd->disk->src, dd->src, "snapshot", rc >= 0);
if (rc == 0) if (rc == 0)
qemuSnapshotDiskUpdateSource(driver, vm, dd, blockdev); qemuSnapshotDiskUpdateSource(vm, dd);
} }
if (rc < 0) if (rc < 0)