[libvirt] [PATCH 2/3] Ensure all cgroup partitions have a suffix of ".partition"

Daniel P. Berrange berrange at redhat.com
Fri Apr 26 11:43:28 UTC 2013


On Fri, Apr 26, 2013 at 05:23:40AM -0600, Eric Blake wrote:
> On 04/26/2013 04:45 AM, Daniel P. Berrange wrote:
> > From: "Daniel P. Berrange" <berrange at redhat.com>
> > 
> > If the partition named passed in the XML does not already have
> > a suffix, ensure it gets a '.partition' added to each component.
> > The exceptions are /machine, /user and /system which do not need
> > to have a suffix, since they are fixed partitions at the top
> > level.
> > 
> > Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
> > ---
> >  src/util/vircgroup.c  |  57 +++++++++++++++++++++--
> >  tests/vircgrouptest.c | 123 ++++++++++++++++++++++++++++++++++++--------------
> >  2 files changed, 143 insertions(+), 37 deletions(-)
> > 
> 
> > -    rc = virCgroupNew(path, NULL, controllers, group);
> > +    /* XXX convert all cgroups APIs to use error report
> > +     * APIs instead of returning errno */
> > +    if (!(newpath = virCgroupSetPartitionSuffix(path))) {
> > +        virResetLastError();
> > +        rc = -ENOMEM;
> > +        goto cleanup;
> > +    }
> 
> Yeah, I can see why you added that comment.  But I looked through all
> the code paths, and looks like the only error possible is OOM, so your
> conversion of failure back to errno is correct.

And with the conversion to make VIR_ALLOC report OOM errors by default,
we really need to bring vircgroup.c into line with other code. In fact
I'd like to see us eliminate pretty much all cases of functions returning
errnos.


Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list