]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: snapshot: Move all cleanup of snapshot disk data to qemuDomainSnapshotDiskDataFree
authorPeter Krempa <pkrempa@redhat.com>
Wed, 5 Jun 2019 13:16:34 +0000 (15:16 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 10 Jun 2019 12:01:09 +0000 (14:01 +0200)
qemuDomainSnapshotDiskDataFree also removes the resources associated
with the disk data. Move the unlinking of the just-created file so that
we can unify the cleanup paths.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_driver.c

index f1886e37b691bd780fd2d6400b5916f34812c1f8..1e1cb8d4caef9453524d547e6fa001aa0ad5ec37 100644 (file)
@@ -15049,6 +15049,12 @@ qemuDomainSnapshotDiskDataCleanup(qemuDomainSnapshotDiskDataPtr data,
         /* on success of the snapshot the 'src' and 'persistsrc' properties will
          * be set to NULL by qemuDomainSnapshotUpdateDiskSources */
         if (data[i].src) {
+            if (data[i].created &&
+                virStorageFileUnlink(data[i].src) < 0) {
+                VIR_WARN("Unable to remove just-created %s",
+                         NULLSTR(data[i].src->path));
+            }
+
             if (data[i].initialized)
                 virStorageFileDeinit(data[i].src);
 
@@ -15292,14 +15298,6 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver,
  error:
     if (ret < 0) {
         virErrorPreserveLast(&orig_err);
-        for (i = 0; i < ndiskdata; i++) {
-            if (diskdata[i].prepared)
-                qemuDomainStorageSourceAccessRevoke(driver, vm, diskdata[i].src);
-
-            if (diskdata[i].created &&
-                virStorageFileUnlink(diskdata[i].src) < 0)
-                VIR_WARN("Unable to remove just-created %s", diskdata[i].src->path);
-        }
     } else {
         /* on successful snapshot we need to remove locks from the now-old
          * disks and if the VM is paused release locks on the images since qemu