Re: [PATCH 1/3] libxl: implement virDomainGetVcpuPinInfo

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

 



On gio, 2013-12-19 at 21:32 -0700, Jim Fehlig wrote:
> > Signed-off-by: Dario Faggioli <dario.faggioli@xxxxxxxxxx>
> > Cc: Jim Fehlig <jfehlig@xxxxxxxx>
> > Cc: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
> > ---
> >  src/libxl/libxl_driver.c |   83 ++++++++++++++++++++++++++++++++++++++++++++++
> >  1 file changed, 83 insertions(+)

> > +static int
> > +libxlDomainGetVcpuPinInfo(virDomainPtr dom, int ncpumaps,
> > +                          unsigned char *cpumaps, int maplen,
> > +                          unsigned int flags)
> > +{
> > +    libxlDriverPrivatePtr driver = dom->conn->privateData;
> > +    libxlDriverConfigPtr cfg = libxlDriverConfigGet(driver);
> > +    virDomainObjPtr vm = NULL;
> > +    virDomainDefPtr targetDef = NULL;
> > +    virDomainVcpuPinDefPtr *vcpupin_list;
> > +    virBitmapPtr cpumask = NULL;
> > +    int maxcpu, hostcpus, vcpu, pcpu, n, ret = -1;
> > +    unsigned char *cpumap;
> > +    bool pinned;
> > +
> > +    virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
> > +                  VIR_DOMAIN_AFFECT_CONFIG, -1);
> > +
> > +    if (!(vm = libxlDomObjFromDomain(dom)))
> > +        goto cleanup;
> > +
> > +    if (virDomainGetVcpuPinInfoEnsureACL(dom->conn, vm->def) < 0)
> > +        goto cleanup;
> > +
> > +    if (virDomainLiveConfigHelperMethod(cfg->caps, driver->xmlopt, vm,
> > +                                        &flags, &targetDef) < 0)
> > +        goto cleanup;
> > +
> > +    if (flags & VIR_DOMAIN_AFFECT_LIVE) {
> > +        targetDef = vm->def;
> > +    }
> > +
> > +    sa_assert(targetDef);
> >   
> 
> I think we should add a comment stating this is needed to silence
> Coverity, similar to the qemu driver.
> 
Ok, I'll do.

> > +
> > +    /* Clamp to actual number of vcpus */
> > +    if (ncpumaps > targetDef->vcpus)
> > +        ncpumaps = targetDef->vcpus;
> > +
> > +    if (!cpumaps || ncpumaps < 1) {
> > +        virReportError(VIR_ERR_INVALID_ARG, "%s",
> > +                       _("cannot return affinity via a NULL pointer"));
> > +        goto cleanup;
> > +    }
> >   
> 
> cpumaps is guaranteed to be non-NULL on entry and ncpumaps is guaranteed
> to be > 0 on entry, so the above check can be removed.
> 
Right! I actually did saw that, but then forgot when going down to code
the thing. :-)

I'll get rid of this in v2.

Thanks and Regards,
Dario

-- 
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)

Attachment: signature.asc
Description: This is a digitally signed message part

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]