]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: snapshot: Don't kill access to disk if snapshot creation fails
authorPeter Krempa <pkrempa@redhat.com>
Fri, 31 May 2013 13:38:46 +0000 (15:38 +0200)
committerCole Robinson <crobinso@redhat.com>
Thu, 11 Jul 2013 21:45:22 +0000 (17:45 -0400)
If snapshot creation failed for example due to invalid use of the
"REUSE_EXTERNAL" flag, libvirt killed access to the original image file
instead of the new image file. On machines with selinux this kills the
whole VM as the selinux context is enforced immediately.

* qemu_driver.c:qemuDomainSnapshotUndoSingleDiskActive():
    - Kill access to the new image file instead of the old one.

Partially resolves: https://bugzilla.redhat.com/show_bug.cgi?id=906639

(cherry picked from commit 177046753fa427609f217c319dba6fa465a4add4)

src/qemu/qemu_driver.c

index 7c6e42dbc9ee1002e88dbb7b79c5748bcf6b301d..cb24e2b8bfdf8ce48fa5462ab90976d1ec393f5d 100644 (file)
@@ -10975,7 +10975,7 @@ qemuDomainSnapshotUndoSingleDiskActive(virQEMUDriverPtr driver,
         goto cleanup;
     }
 
-    qemuDomainPrepareDiskChainElement(driver, vm, disk, origdisk->src,
+    qemuDomainPrepareDiskChainElement(driver, vm, disk, disk->src,
                                       VIR_DISK_CHAIN_NO_ACCESS);
     if (need_unlink && stat(disk->src, &st) == 0 &&
         S_ISREG(st.st_mode) && unlink(disk->src) < 0)