[libvirt] [PATCH] qemu: add capability probing for block-stream
Eric Blake
eblake at redhat.com
Fri Oct 24 19:25:24 UTC 2014
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 at redhat.com>
> ---
> 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 539 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20141024/80391f6a/attachment-0001.sig>
More information about the libvir-list
mailing list