[libvirt] [PATCH 02/10] qemu: blockjob: Properly propagate cancellation of blockjobs

Peter Krempa posted 10 patches 12 weeks ago

[libvirt] [PATCH 02/10] qemu: blockjob: Properly propagate cancellation of blockjobs

Posted by Peter Krempa 12 weeks ago
qemu returns an error message in the job statistics even if the job was
cancelled to emphasize it was not successful. Libvirt didn't properly
transform it into QEMU_BLOCKJOB_STATE_CANCELLED though.

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

diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c
index 92e4d391c9..2283d49c61 100644
--- a/src/qemu/qemu_blockjob.c
+++ b/src/qemu/qemu_blockjob.c
@@ -1313,7 +1313,8 @@ qemuBlockJobEventProcessConcluded(qemuBlockJobDataPtr job,
     if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0)
         goto cleanup;

-    if (job->newstate == QEMU_BLOCKJOB_STATE_COMPLETED &&
+    if ((job->newstate == QEMU_BLOCKJOB_STATE_COMPLETED ||
+         job->newstate == QEMU_BLOCKJOB_STATE_FAILED) &&
         job->state == QEMU_BLOCKJOB_STATE_ABORTING)
         job->newstate = QEMU_BLOCKJOB_STATE_CANCELLED;

-- 
2.23.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH 02/10] qemu: blockjob: Properly propagate cancellation of blockjobs

Posted by Cole Robinson 12 weeks ago
On 11/26/19 10:17 AM, Peter Krempa wrote:
> qemu returns an error message in the job statistics even if the job was
> cancelled to emphasize it was not successful. Libvirt didn't properly
> transform it into QEMU_BLOCKJOB_STATE_CANCELLED though.
> 
> Signed-off-by: Peter Krempa <pkrempa@redhat.com>
> ---
>  src/qemu/qemu_blockjob.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c
> index 92e4d391c9..2283d49c61 100644
> --- a/src/qemu/qemu_blockjob.c
> +++ b/src/qemu/qemu_blockjob.c
> @@ -1313,7 +1313,8 @@ qemuBlockJobEventProcessConcluded(qemuBlockJobDataPtr job,
>      if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0)
>          goto cleanup;
> 
> -    if (job->newstate == QEMU_BLOCKJOB_STATE_COMPLETED &&
> +    if ((job->newstate == QEMU_BLOCKJOB_STATE_COMPLETED ||
> +         job->newstate == QEMU_BLOCKJOB_STATE_FAILED) &&
>          job->state == QEMU_BLOCKJOB_STATE_ABORTING)
>          job->newstate = QEMU_BLOCKJOB_STATE_CANCELLED;
> 

Reviewed-by: Cole Robinson <crobinso@redhat.com>

- Cole

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list