Re: [PATCH 2/4] parallels: handle unlimited cpus on containers

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

 



On 120912 14:08:37, Daniel Veillard wrote:
> On Mon, Sep 10, 2012 at 07:22:43PM +0400, Dmitry Guryanov wrote:
> > User may set "unlimited" cpus for containers, which means to
> > take all available cpus on the node.
> > 
> > Signed-off-by: Dmitry Guryanov <dguryanov@xxxxxxxxxxxxx>
> > ---
> >  src/parallels/parallels_driver.c |   23 ++++++++++++++++++++---
> >  1 files changed, 20 insertions(+), 3 deletions(-)
> > 
> > diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c
> > index 45a3d82..ace75a6 100644
> > --- a/src/parallels/parallels_driver.c
> > +++ b/src/parallels/parallels_driver.c
> > @@ -468,12 +468,29 @@ parallelsLoadDomain(parallelsConnPtr privconn, virJSONValuePtr jobj)
> >          goto cleanup;
> >      }
> >  
> > -    if (virJSONValueObjectGetNumberUint(jobj3, "cpus", &x) < 0) {
> > +    if (virJSONValueObjectGetNumberUint(jobj3, "cpus", &x) == 0) {
> > +        def->vcpus = x;
> > +        def->maxvcpus = x;
> > +    } else if ((tmp = virJSONValueObjectGetString(jobj3, "cpus"))) {
> > +        if (STREQ(tmp, "unlimited")) {
> > +            virNodeInfo nodeinfo;
> > +
> > +            if (nodeGetInfo(NULL, &nodeinfo) < 0) {
> > +                virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
> > +                               _("Can't get node info"));
> > +                goto cleanup;
> > +            }
> > +
> > +            def->vcpus = nodeinfo.cpus;
> > +            def->maxvcpus = def->vcpus;
> > +        } else {
> > +            parallelsParseError();
> > +            goto cleanup;
> > +        }
> > +    } else {
> >          parallelsParseError();
> >          goto cleanup;
> >      }
> > -    def->vcpus = x;
> > -    def->maxvcpus = x;
> >  
> >      if (!(jobj3 = virJSONValueObjectGet(jobj2, "memory"))) {
> >          parallelsParseError();
> 
>   Looks unrelated to the other patches, but fine, ACK,
> 

Containers use all CPUs on node by default, and the driver will return
error, if there are such containers. So I decided to include this patch
in series.

> Daniel
> 
> -- 
> Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
> daniel@xxxxxxxxxxxx  | Rpmfind RPM search engine http://rpmfind.net/
> http://veillard.com/ | virtualization library  http://libvirt.org/

--
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]