[PATCH 2/5] qemu: blockjob: Actually delete temporary bitmap on failed active commit

Peter Krempa posted 5 patches 4 years, 4 months ago
[PATCH 2/5] qemu: blockjob: Actually delete temporary bitmap on failed active commit
Posted by Peter Krempa 4 years, 4 months ago
Commit 20a7abc2d2d tried to delete the possibly leftover bitmap but
neglected to call the actual monitor to do so.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
 src/qemu/qemu_blockjob.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c
index 9b78733c53..c49c98e547 100644
--- a/src/qemu/qemu_blockjob.c
+++ b/src/qemu/qemu_blockjob.c
@@ -1416,8 +1416,10 @@ qemuBlockJobProcessEventConcludedCopyAbort(virQEMUDriverPtr driver,
 static void
 qemuBlockJobProcessEventFailedActiveCommit(virQEMUDriverPtr driver,
                                            virDomainObjPtr vm,
-                                           qemuBlockJobDataPtr job)
+                                           qemuBlockJobDataPtr job,
+                                           qemuDomainAsyncJob asyncJob)
 {
+    qemuDomainObjPrivatePtr priv = vm->privateData;
     g_autoptr(virJSONValue) actions = virJSONValueNewArray();
     virDomainDiskDefPtr disk = job->disk;

@@ -1429,6 +1431,13 @@ qemuBlockJobProcessEventFailedActiveCommit(virQEMUDriverPtr driver,
     ignore_value(qemuMonitorTransactionBitmapRemove(actions, disk->mirror->nodeformat,
                                                     "libvirt-tmp-activewrite"));

+    if (qemuDomainObjEnterMonitorAsync(priv->driver, vm, asyncJob) < 0)
+        return;
+
+    qemuMonitorTransaction(priv->mon, &actions);
+
+    if (qemuDomainObjExitMonitor(priv->driver, vm) < 0)
+        return;

     /* Ideally, we would make the backing chain read only again (yes, SELinux
      * can do that using different labels). But that is not implemented yet and
@@ -1553,7 +1562,7 @@ qemuBlockJobEventProcessConcludedTransition(qemuBlockJobDataPtr job,
         if (success) {
             qemuBlockJobProcessEventCompletedActiveCommit(driver, vm, job, asyncJob);
         } else {
-            qemuBlockJobProcessEventFailedActiveCommit(driver, vm, job);
+            qemuBlockJobProcessEventFailedActiveCommit(driver, vm, job, asyncJob);
         }
         break;

-- 
2.26.2

Re: [PATCH 2/5] qemu: blockjob: Actually delete temporary bitmap on failed active commit
Posted by Eric Blake 4 years, 4 months ago
On 7/16/20 9:20 AM, Peter Krempa wrote:
> Commit 20a7abc2d2d tried to delete the possibly leftover bitmap but
> neglected to call the actual monitor to do so.
> 
> Signed-off-by: Peter Krempa <pkrempa@redhat.com>
> ---
>   src/qemu/qemu_blockjob.c | 13 +++++++++++--
>   1 file changed, 11 insertions(+), 2 deletions(-)

Yeah, building up the command structure doesn't help if you don't run it ;)

Reviewed-by: Eric Blake <eblake@redhat.com>


-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org