[libvirt] [PATCH V4] blockjob: Fix error checking of blockjob status

Jie Wang posted 1 patch 6 years, 3 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/1515120813-116674-1-git-send-email-wangjie88@huawei.com
src/qemu/qemu_monitor_json.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[libvirt] [PATCH V4] blockjob: Fix error checking of blockjob status
Posted by Jie Wang 6 years, 3 months ago
offset and len can also be equal to 0 on failed if blockjob return
status:"BLOCK_JOB_COMPLETED" with error:"File descriptor in bad state",
so we need to check 'error' in this case.
---
 src/qemu/qemu_monitor_json.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index e45868b..39c0909 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -886,7 +886,7 @@ qemuMonitorJSONHandleBlockJobImpl(qemuMonitorPtr mon,
     case VIR_DOMAIN_BLOCK_JOB_COMPLETED:
         error = virJSONValueObjectGetString(data, "error");
         /* Make sure the whole device has been processed */
-        if (offset != len)
+        if (offset != len || error)
             event = VIR_DOMAIN_BLOCK_JOB_FAILED;
         break;
     case VIR_DOMAIN_BLOCK_JOB_CANCELED:
-- 
1.8.3.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] Ping Re: [PATCH V4] blockjob: Fix error checking of blockjob status
Posted by WangJie (Captain) 6 years, 3 months ago
Ping

On 2018/1/5 10:53, Jie Wang wrote:
> offset and len can also be equal to 0 on failed if blockjob return
> status:"BLOCK_JOB_COMPLETED" with error:"File descriptor in bad state",
> so we need to check 'error' in this case.
> ---
>  src/qemu/qemu_monitor_json.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
> index e45868b..39c0909 100644
> --- a/src/qemu/qemu_monitor_json.c
> +++ b/src/qemu/qemu_monitor_json.c
> @@ -886,7 +886,7 @@ qemuMonitorJSONHandleBlockJobImpl(qemuMonitorPtr mon,
>      case VIR_DOMAIN_BLOCK_JOB_COMPLETED:
>          error = virJSONValueObjectGetString(data, "error");
>          /* Make sure the whole device has been processed */
> -        if (offset != len)
> +        if (offset != len || error)
>              event = VIR_DOMAIN_BLOCK_JOB_FAILED;
>          break;
>      case VIR_DOMAIN_BLOCK_JOB_CANCELED:


--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] Ping Re: [PATCH V4] blockjob: Fix error checking of blockjob status
Posted by WangJie (Captain) 6 years, 3 months ago
ping

On 2018/1/5 10:53, Jie Wang wrote:
> offset and len can also be equal to 0 on failed if blockjob return
> status:"BLOCK_JOB_COMPLETED" with error:"File descriptor in bad state",
> so we need to check 'error' in this case.
> ---
>  src/qemu/qemu_monitor_json.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
> index e45868b..39c0909 100644
> --- a/src/qemu/qemu_monitor_json.c
> +++ b/src/qemu/qemu_monitor_json.c
> @@ -886,7 +886,7 @@ qemuMonitorJSONHandleBlockJobImpl(qemuMonitorPtr mon,
>      case VIR_DOMAIN_BLOCK_JOB_COMPLETED:
>          error = virJSONValueObjectGetString(data, "error");
>          /* Make sure the whole device has been processed */
> -        if (offset != len)
> +        if (offset != len || error)
>              event = VIR_DOMAIN_BLOCK_JOB_FAILED;
>          break;
>      case VIR_DOMAIN_BLOCK_JOB_CANCELED:
> 

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