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

Re: [libvirt] [PATCH v4 2/4] qemu: guestinfo: handle unsupported agent commands




On 8/27/19 4:35 PM, Jonathon Jongsma wrote:
> When we're collecting guest information, older agents may not support
> all agent commands. In the case where the user requested all info
> types (i.e. types == 0), ignore unsupported command errors and gather as
> much information as possible. If the agent command failed for some other
> reason, or if the user explciitly requested a specific info type (i.e.
> types != 0), abort on the first error.
> 
> Signed-off-by: Jonathon Jongsma <jjongsma redhat com>
> ---
>  src/qemu/qemu_agent.c  | 70 ++++++++++++++++++++++++++++++++++++++----
>  src/qemu/qemu_driver.c | 33 ++++++++++----------
>  tests/qemuagenttest.c  |  2 +-
>  3 files changed, 82 insertions(+), 23 deletions(-)
> 
> diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c
> index f2a8bb6263..c63db968c6 100644
> --- a/src/qemu/qemu_agent.c
> +++ b/src/qemu/qemu_agent.c
> @@ -995,6 +995,26 @@ qemuAgentStringifyErrorClass(const char *klass)
>          return "unknown QEMU command error";
>  }
>  
> +/* Checks whether the agent reply msg is an error caused by an unsupported
> + * command.
> + *
> + * Returns true when reply is CommandNotFound or CommandDisabled
> + *         false otherwise
> + */
> +static bool
> +qemuAgentErrorCommandUnsupported(virJSONValuePtr reply)
> +{
> +    const char *klass;
> +    virJSONValuePtr error = virJSONValueObjectGet(reply, "error");> +

Coverity notes it's possible to enter this function with @reply ==
NULL... Calls to qemuAgentCommand will set @*reply = NULL immediately
and only fill in @*reply when/if qemuAgentSend returns 0 *and*
@msg.rxObject != NULL.

When virJSONValueObjectGet is called it derefs it's first parameter
(@object) immediately

John

[...]


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