In the cleanup path we already checked whether a snapshot needed to be
taken by looking into the collected data. Use the same approach when
creating the snapshot command data and when committing the changes to the
domain definition.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
* VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL with a valid file name and
* qcow2 format. */
for (i = 0; i < snap->def->ndisks; i++) {
- if (snap->def->disks[i].snapshot == VIR_DOMAIN_SNAPSHOT_LOCATION_NONE)
+ if (!diskdata[i].src)
continue;
ret = qemuDomainSnapshotCreateSingleDiskActive(driver, vm,
goto error;
}
- for (i = 0; i < snap->def->ndisks; i++)
- qemuDomainSnapshotUpdateDiskSources(&diskdata[i], &persist);
+ for (i = 0; i < snap->def->ndisks; i++) {
+ qemuDomainSnapshotDiskDataPtr dd = &diskdata[i];
+
+ if (!dd->src)
+ continue;
+
+ qemuDomainSnapshotUpdateDiskSources(dd, &persist);
+ }
}
error: