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

Re: [libvirt] [PATCH] fix check of vcpuid in virDomainVcpuPinDefParseXML



On Thu, Aug 23, 2012 at 02:12:32PM +0800, Daniel Veillard wrote:
> On Thu, Aug 23, 2012 at 10:31:12AM +0800, Hu Tao wrote:
> > For emulator, the vcpuid field is always set to -1, instead of parsing
> > XML for the value of it.
> > 
> > ---
> >  src/conf/domain_conf.c |   22 ++++++++++++----------
> >  1 file changed, 12 insertions(+), 10 deletions(-)
> > 
> > diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> > index 7242205..419088c 100644
> > --- a/src/conf/domain_conf.c
> > +++ b/src/conf/domain_conf.c
> > @@ -7923,7 +7923,7 @@ virDomainVcpuPinDefParseXML(const xmlNodePtr node,
> >  {
> >      virDomainVcpuPinDefPtr def;
> >      xmlNodePtr oldnode = ctxt->node;
> > -    int vcpuid;
> > +    int vcpuid = -1;
> >      char *tmp = NULL;
> >      int ret;
> >  
> > @@ -7934,15 +7934,17 @@ virDomainVcpuPinDefParseXML(const xmlNodePtr node,
> >  
> >      ctxt->node = node;
> >  
> > -    ret = virXPathInt("string(./@vcpu)", ctxt, &vcpuid);
> > -    if ((ret == -2) || (vcpuid < -1)) {
> > -        virReportError(VIR_ERR_INTERNAL_ERROR,
> > -                       "%s", _("vcpu id must be an unsigned integer or -1"));
> > -        goto error;
> > -    } else if ((vcpuid == -1) && (emulator == 0)) {
> > -        virReportError(VIR_ERR_INTERNAL_ERROR,
> > -                       "%s", _("vcpu id value -1 is not allowed for vcpupin"));
> > -        goto error;
> > +    if (emulator == 0) {
> > +        ret = virXPathInt("string(./@vcpu)", ctxt, &vcpuid);
> > +        if ((ret == -2) || (vcpuid < -1)) {
> > +            virReportError(VIR_ERR_INTERNAL_ERROR,
> > +                           "%s", _("vcpu id must be an unsigned integer or -1"));
> > +            goto error;
> > +        } else if (vcpuid == -1) {
> > +            virReportError(VIR_ERR_INTERNAL_ERROR,
> > +                           "%s", _("vcpu id value -1 is not allowed for vcpupin"));
> > +            goto error;
> > +        }
> >      }
> >  
> >      if (vcpuid >= maxvcpus) {
> 
>   Ah, right, I missed that part when I refactored that function !
> ACK, i'm pushing this now,

Thank you!

-- 
Thanks,
Hu Tao


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