[libvirt] [PATCH] conf: Ignore vcpupin for not onlined vcpus when parsing

Martin Kletzander mkletzan at redhat.com
Fri Oct 12 14:00:55 UTC 2012


On 10/12/2012 03:52 PM, Osier Yang wrote:
> Setting pinning policy for vcpu which exceeds current vcpus number
> just makes no sense, however, it could cause various problems, E.g.
> 
> <vcpu current='1'>4</vcpu>
> <cputune>
>   <vcpupin vcpuid='3' cpuset='4'/>
> </cputune>
> 
> % virsh start linux
> error: Failed to start domain linux
> error: cannot set CPU affinity on process 32534: No such process
> 

Well pointed out.

> We must have some odd codes underlying which produces the
> "on process 32534", but the point is why we not to prevent
> earlier when parsing? Note that this is only one of the
> problem it could cause.
> 

We should definitely fix it there as well.  However I *think* that it is
caused just by us trying to move the processor more times, which would
be fixed by this.  But that's just an idea.

> This patch is to ignore the <vcpupin> for not onlined vcpus.
> 
> ---
>  src/conf/domain_conf.c |   10 +++++++++-
>  1 files changed, 9 insertions(+), 1 deletions(-)
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 3c3d0ae..5141be6 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -8806,7 +8806,15 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
>              goto error;
>          }
>  
> -        def->cputune.vcpupin[def->cputune.nvcpupin++] = vcpupin;
> +        if (vcpupin->vcpuid >= def->vcpus)
> +            /* To avoid the regression when daemon loading
> +             * domain confs, we can't simply error out if
> +             * <vcpupin> nodes greater than current vcpus,
> +             * ignoring them instead.
> +             */
> +            VIR_WARN("Ignore vcpupin for not onlined vcpus");
> +        else
> +            def->cputune.vcpupin[def->cputune.nvcpupin++] = vcpupin;
>      }
>      VIR_FREE(nodes);
>  
> 

ACK,

Martin




More information about the libvir-list mailing list