On Tue, Jul 30, 2013 at 12:13:58PM -0600, Eric Blake wrote:
On 07/26/2013 09:48 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange(a)redhat.com>
>
> Systemd uses a named cgroup mount for tracking processes. Add
> it as another type of controller, albeit one which we have to
> special case in a number of places. In particular we must
> never create/delete directories there, nor add tasks. Essentially
> the systemd mount is to be considered read-only for libvirt.
>
> Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
> ---
> src/util/vircgroup.c | 68 +++++++++++++++++++++++++++++++++++++++------------
> src/util/vircgroup.h | 1 +
> tests/vircgrouptest.c | 9 +++++++
> 3 files changed, 63 insertions(+), 15 deletions(-)
>
> @@ -524,13 +541,16 @@ static int virCgroupDetect(virCgroupPtr group,
> return -1;
> }
>
> - if (parent || path[0] == '/') {
> - if (virCgroupCopyPlacement(group, path, parent) < 0)
> - return -1;
> - } else {
> - if (virCgroupDetectPlacement(group, pid, path) < 0)
> - return -1;
This previously called only one of the two functions...
> - }
> + /* In some cases we can copy part of the placement info
> + * based on the parent cgroup...
> + */
> + if ((parent || path[0] == '/') &&
> + virCgroupCopyPlacement(group, path, parent) < 0)
> + return -1;
> +
> + /* ... but use /proc/cgroups to fill in the rest */
> + if (virCgroupDetectPlacement(group, pid, path) < 0)
...now, if virCgroupCopyPlacement returns 0, it calls both functions.
Is that intentional?
Yes, when we use CopyPlacement it sets up all mounts, except for
the systemd mount, which we must always probe for. The DetectPlacement
method was changed so that it only fills in data, not already filled
in by CopyPlacement.
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 :|