44539d
From f78e7381ac369952197ffb23b02f56ee430214e7 Mon Sep 17 00:00:00 2001
44539d
Message-Id: <f78e7381ac369952197ffb23b02f56ee430214e7@dist-git>
44539d
From: Eric Blake <eblake@redhat.com>
44539d
Date: Thu, 21 Aug 2014 16:07:30 -0600
44539d
Subject: [PATCH] qemu: reject rather than hang on blockcommit of active layer
44539d
44539d
7.0.z: https://bugzilla.redhat.com/show_bug.cgi?id=1150379
44539d
7.1: https://bugzilla.redhat.com/show_bug.cgi?id=1062142
44539d
44539d
qemu 2.0 added the ability to commit the active layer, but slightly
44539d
differently than what libvirt had been anticipating in its
44539d
implementation of the virDomainBlockCommit call.  As a result, if
44539d
you attempt to do a 'virsh blockcommit $dom vda', qemu gets into a
44539d
state where it is waiting on libvirt to end the job, while libvirt
44539d
is waiting on qemu to end the job, and the guest is effectively
44539d
hung with regards to further commands for that block device.
44539d
44539d
I have patches coming down the pipeline that will add full support
44539d
for blockcommit of the active layer when coupled with qemu 2.0 or
44539d
later; but they depend on Peter's improvements to block job handling
44539d
and form enough of a new feature that they are not ready for
44539d
inclusion in the 1.2.5 release.  So for now, just reject the
44539d
attempt, rather than letting the user get stuck.  This is no worse
44539d
than the behavior of qemu 1.7 rejecting the job.
44539d
44539d
* src/qemu/qemu_driver.c (qemuDomainBlockCommit): Reject active
44539d
commit.
44539d
44539d
Signed-off-by: Eric Blake <eblake@redhat.com>
44539d
(cherry picked from commit e6bcbcd32c70ae394e7b6a530012fe8b07a59b5d)
44539d
44539d
Conflicts:
44539d
	src/qemu/qemu_driver.c - no refactoring of virStorageFileChainLookup
44539d
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
44539d
---
44539d
 src/qemu/qemu_driver.c | 10 ++++++++++
44539d
 1 file changed, 10 insertions(+)
44539d
44539d
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
44539d
index 72d03b5..1ce4c39 100644
44539d
--- a/src/qemu/qemu_driver.c
44539d
+++ b/src/qemu/qemu_driver.c
44539d
@@ -15312,6 +15312,16 @@ qemuDomainBlockCommit(virDomainPtr dom, const char *path, const char *base,
44539d
                        top, path);
44539d
         goto endjob;
44539d
     }
44539d
+
44539d
+    /* FIXME: qemu 2.0 supports active commit, but as a two-stage
44539d
+     * process; qemu 2.1 is further improving active commit. We need
44539d
+     * to start supporting it in libvirt. */
44539d
+    if (top_meta == disk->backingChain) {
44539d
+        virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
44539d
+                       _("committing the active layer not supported yet"));
44539d
+        goto endjob;
44539d
+    }
44539d
+
44539d
     if (!top_meta || !top_meta->backingStore) {
44539d
         virReportError(VIR_ERR_INVALID_ARG,
44539d
                        _("top '%s' in chain for '%s' has no backing file"),
44539d
-- 
44539d
2.2.0
44539d