[libvirt] [PATCH] qemu: snapshot: Don't kill access to disk if snapshot creation fails

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 --- src/qemu/qemu_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index e638e7c..5ca0fd4 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -11309,7 +11309,7 @@ qemuDomainSnapshotUndoSingleDiskActive(virQEMUDriverPtr driver, (persistDisk && VIR_STRDUP(persistSource, source) < 0)) 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) -- 1.8.2.1

On 05/31/2013 07:45 AM, Peter Krempa wrote:
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 --- src/qemu/qemu_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
ACK, and okay for 1.0.6.
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index e638e7c..5ca0fd4 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -11309,7 +11309,7 @@ qemuDomainSnapshotUndoSingleDiskActive(virQEMUDriverPtr driver, (persistDisk && VIR_STRDUP(persistSource, source) < 0)) 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)
-- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On 05/31/13 16:01, Eric Blake wrote:
On 05/31/2013 07:45 AM, Peter Krempa wrote:
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 --- src/qemu/qemu_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
ACK, and okay for 1.0.6.
Pushed. Thanks. Peter
participants (2)
-
Eric Blake
-
Peter Krempa