[libvirt] [PATCH 1/2] virsh: really fix the error if vcpu number exceed the guest maxvcpu number

John Ferlan jferlan at redhat.com
Tue Jul 14 21:21:45 UTC 2015



On 07/14/2015 09:10 AM, Luyao Huang wrote:
> Commit '848ab68' left a issue: when we try to get a vcpupin info with no
> no flags or --current flags, we still will get the wrong error. Because
> VIR_DOMAIN_AFFECT_CURRENT is 0, so this check flags & VIR_DOMAIN_AFFECT_CURRENT
> will always get false.
> 
> Signed-off-by: Luyao Huang <lhuang at redhat.com>
> Reported by: Peter Krempa <pkrempa at redhat.com>
> ---
>  tools/virsh-domain.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 

hmmm ...  see Michal's patch on this (and my response):

http://www.redhat.com/archives/libvir-list/2015-July/msg00555.html

Of course when I merged your change when I made the original adjustment
based on review, I never ran it through my coverity checker either).

John
> diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
> index ac04ded..00b012b 100644
> --- a/tools/virsh-domain.c
> +++ b/tools/virsh-domain.c
> @@ -6499,8 +6499,8 @@ cmdVcpuPin(vshControl *ctl, const vshCmd *cmd)
>  
>          if (got_vcpu && vcpu >= ncpus) {
>              if (flags & VIR_DOMAIN_AFFECT_LIVE ||
> -                (flags & VIR_DOMAIN_AFFECT_CURRENT &&
> -                 virDomainIsActive(dom) == 1))
> +                ((flags & (VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG))
> +                 == VIR_DOMAIN_AFFECT_CURRENT && virDomainIsActive(dom) == 1))
>                  vshError(ctl,
>                           _("vcpu %d is out of range of live cpu count %d"),
>                           vcpu, ncpus);
> 




More information about the libvir-list mailing list