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

Re: [libvirt] [PATCH] virsh: Report errors if arguments of the schedinfo command are incorrect



On Mon, Dec 03, 2012 at 14:46:51 +0100, Peter Krempa wrote:
> Libvirt's helper API's when called directly don't raise the error so
> that virsh remembers it. Subsequent calls to libvirt API's might reset
> the error.
> 
> In case of schedinfo virDomainFree() in the cleanup section resets the
> error when virTypedParameterAssignFromStr() fails.
> 
> This patch adds function vshSaveLibvirtError() that can be called after
> calling libvirt helper APIs to ensure the error is remembered.
> ---
>  tools/virsh-domain.c | 8 ++++++--
>  tools/virsh.c        | 9 +++++++++
>  tools/virsh.h        | 1 +
>  3 files changed, 16 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
> index 73ebba9..1f7aff7 100644
> --- a/tools/virsh-domain.c
> +++ b/tools/virsh-domain.c
> @@ -3512,8 +3512,10 @@ cmdSchedInfoUpdate(vshControl *ctl, const vshCmd *cmd,
>              if (virTypedParameterAssign(&(params[nparams++]),
>                                          param->field,
>                                          param->type,
> -                                        val) < 0)
> +                                        val) < 0) {
> +                vshSaveLibvirtError();
>                  goto cleanup;
> +            }
> 
>              continue;
>          }

Looks like there must be a lot of similar issues in other areas of virsh.

ACK,

Jirka


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