Re: [PATCH] qemu: add capability probing for block-stream

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 09/15/2014 11:06 PM, Shanzhi Yu wrote:
> Since block-stream is not supported on qemu-kvm, so libvirt should
> post more accurate error info when do blockpull with qemu-kvm but
> not "Command 'block-stream' is not found"
> 
> Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1140981
> Signed-off-by: Shanzhi Yu <shyu@xxxxxxxxxx>
> ---
>  src/qemu/qemu_capabilities.c |  2 ++
>  src/qemu/qemu_capabilities.h |  1 +
>  src/qemu/qemu_driver.c       | 13 +++++--------
>  3 files changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
> index 81ada48..5674f4f 100644
> --- a/src/qemu/qemu_capabilities.c
> +++ b/src/qemu/qemu_capabilities.c
> @@ -269,6 +269,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
>  
>                "splash-timeout", /* 175 */
>                "iothread",
> +              "block-stream",
>      );
>  
>  
> @@ -1426,6 +1427,7 @@ struct virQEMUCapsStringFlags virQEMUCapsCommands[] = {
>      { "query-spice", QEMU_CAPS_SPICE },
>      { "query-kvm", QEMU_CAPS_KVM },
>      { "block-commit", QEMU_CAPS_BLOCK_COMMIT },
> +    { "block-stream", QEMU_CAPS_BLOCK_STREAM },

This part seems okay (we really haven't tracked this before?)...

> +++ b/src/qemu/qemu_driver.c
> @@ -14980,15 +14980,12 @@ qemuDomainBlockJobImpl(virDomainObjPtr vm,
>          virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
>                         _("block jobs not supported with this QEMU binary"));
>          goto cleanup;
> -    } else if (base) {
> -        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> -                       _("partial block pull not supported with this "
> -                         "QEMU binary"));
> -        goto cleanup;
> -    } else if (mode == BLOCK_JOB_PULL && bandwidth) {
> +    }
> +
> +    if (mode == BLOCK_JOB_PULL &&
> +        !(virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCK_STREAM))){

But here you are throwing away existing useful error messages for other
situations (such as when block-stream exists, but is too old to support
a base).  I think the flow would look a bit better as:

  if (..._ASYNC) {
      async = true;
  } else if (!..._SYNC) {
      error: block jobs unsupported
+ } else if (mode == BLOCK_JOB_PULL && !...STREAM) {
+     error: block pull unsupported
  } else if (base) {
      error: partial pull unsupported
  } else if (mode == BLOCK_JOB_PULL && bandwidth) {
      error: bandwidth unsupported
  }


-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

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

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]