[libvirt] [PATCH] blockjob: Report correct error when missing qemu support
Eric Blake
eblake at redhat.com
Mon Aug 22 15:53:51 UTC 2011
On 08/22/2011 09:45 AM, Adam Litke wrote:
> When executing blockjob monitor commands, we are not checking for
> CommandNotFound errors. This results in 'unexpected error' messages when using
> a qemu without support for the required commands. Fix this up by checking for
> CommandNotFound errors for QMP and detecting this condition for the text
> monitor.
>
> This fixes the problem reported in Bug 727502.
>
> Signed-off-by: Adam Litke<agl at us.ibm.com>
> ---
> src/qemu/qemu_monitor_json.c | 3 +++
> src/qemu/qemu_monitor_text.c | 20 ++++++++++++++++++++
> 2 files changed, 23 insertions(+), 0 deletions(-)
Hmm, I like the factorization into qemuMonitorTextCommandNotFound() a
little better than Osier's patch for the same issue:
https://www.redhat.com/archives/libvir-list/2011-August/msg00963.html
But I like Osier's approach of listing which command was not found
better than this one.
> +++ b/src/qemu/qemu_monitor_text.c
> @@ -271,6 +271,19 @@ qemuMonitorTextCommandWithFd(qemuMonitorPtr mon,
> scm_fd, reply);
> }
>
> +/* Check monitor output for evidence that the command was not recognized.
> + * For 'info' commands, qemu returns help text. For other commands, qemu
> + * returns 'unknown command:'.
> + */
> +static int
> +qemuMonitorTextCommandNotFound(const char *reply)
> +{
> + if (strstr(reply, "unknown command:"))
> + return 1;
> + if (strstr(reply, "info version -- show the version of QEMU"))
This seems too specific. Isn't it better to just check for "info
version", in case the text on the rest of the line changes over time?
Can you coordinate with Osier, and agree on a single patch between the
two of you?
--
Eric Blake eblake at redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
More information about the libvir-list
mailing list