Michael Crosby
6c3fd65a5c
Add ability to set cgroups freezer
...
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-04-30 16:07:12 -07:00
Michael Crosby
b8de4afa9d
Merge pull request #5476 from rjnagal/libcontainer-fixes
...
Cleanup cgroups on Set failures
2014-04-29 12:27:31 -07:00
Rohit Jnagal
592fd56d49
Cleanup existing controllers when cleanup fails mid-way.
...
Docker-DCO-1.1-Signed-off-by: Rohit Jnagal <jnagal@google.com> (github: rjnagal)
2014-04-29 18:59:20 +00:00
Michael Crosby
f6024af3e8
Merge pull request #5455 from rjnagal/cgroup-stats
...
Add throttling stats for cpu cgroup
2014-04-28 17:53:37 -07:00
Rohit Jnagal
ed65857dae
Another test to check for invalid stats.
...
Docker-DCO-1.1-Signed-off-by: Rohit Jnagal <jnagal@google.com> (github: rjnagal)
2014-04-29 00:32:05 +00:00
Rohit Jnagal
51d9b2b0a0
Add cpu throttling stats.
...
Docker-DCO-1.1-Signed-off-by: Rohit Jnagal <jnagal@google.com> (github: rjnagal)
2014-04-29 00:18:18 +00:00
Victor Marmol
1749d97ee8
Adding a unit test for pkg/cgroup/fs/memory.go
...
Docker-DCO-1.1-Signed-off-by: Victor Marmol <vmarmol@google.com> (github: vmarmol)
2014-04-28 22:58:25 +00:00
Michael Crosby
5479a8e86f
Merge pull request #5412 from vmarmol/add-blkio-test
...
Adding a test for blkio stats.
2014-04-28 12:50:20 -07:00
Victor Marmol
a49cc7f252
Adding a test for blkio stats.
...
Also adds a test utility we can use for other cgroup tests.
Docker-DCO-1.1-Signed-off-by: Victor Marmol <vmarmol@google.com> (github: vmarmol)
2014-04-26 07:29:13 +00:00
Victor Marmol
38d7599ca3
Add memory usage and max usage stats.
...
Docker-DCO-1.1-Signed-off-by: Victor Marmol <vmarmol@google.com> (github: vmarmol)
2014-04-25 02:51:28 +00:00
Victor Marmol
bcfc527abb
Separating cgroup Memory and MemoryReservation.
...
This will allow for these to be set independently. Keep the current Docker behavior where Memory and MemoryReservation are set to the value of Memory.
Docker-DCO-1.1-Signed-off-by: Victor Marmol <vmarmol@google.com> (github: vmarmol)
2014-04-24 11:09:38 -07:00
Rohit Jnagal
7ff609f95d
Add support for cpu hardcapping to cgroups.
...
Docker-DCO-1.1-Signed-off-by: Rohit Jnagal <jnagal@google.com> (github: rjnagal)
2014-04-24 14:43:02 +00:00
Michael Crosby
ded58db1eb
Use cgo to get systems clock ticks for metrics
...
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-04-21 10:26:22 -07:00
Michael Crosby
26bd4906d6
Refactor stat parsing to use only 8 fields
...
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-04-20 20:45:08 -07:00
Evan Hazlett
ef26b1c65e
work on cpu stats
...
Docker-DCO-1.1-Signed-off-by: Evan Hazlett <ejhazlett@gmail.com> (github: ehazlett)
2014-04-21 00:07:05 -04:00
Michael Crosby
21e6eeffb9
Add freezer stats
...
This one is a problem because the most useful stat is a string and not a
float like verything else. We may have to change the return type
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-04-20 18:35:33 -07:00
Michael Crosby
e09e819712
Reuse cpuacct stats for cpu subsystem
...
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-04-20 18:20:44 -07:00
Michael Crosby
3bd149f766
Fix parsing of blkio files
...
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-04-20 18:18:17 -07:00
Michael Crosby
dcbca94904
Add external function to get cgroup stats
...
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-04-20 17:36:20 -07:00
Michael Crosby
ab15aa234c
Refactor stats and add them to all subsystems
...
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-04-20 12:02:39 -07:00
Michael Crosby
b5b44ad439
Squashed commit of the following:
...
commit 75af1649b063abbc5d662fd2f8bc4ff62c927687
Author: Evan Hazlett <ejhazlett@gmail.com>
Date: Sun Apr 20 01:32:42 2014 -0400
more refactor
commit 43b36d0f15d634497127bcb17dacaa70ae92e903
Author: Evan Hazlett <ejhazlett@gmail.com>
Date: Sun Apr 20 01:11:49 2014 -0400
refactored cgroup param parsing to util func
commit e3738b0168a075bd92ec828879b0e46bdbbe3845
Author: Evan Hazlett <ejhazlett@gmail.com>
Date: Sun Apr 20 00:57:19 2014 -0400
dat error checking
commit 57872bcc59403ecd308cfe97c78f73d6ca58d165
Author: Evan Hazlett <ejhazlett@gmail.com>
Date: Sun Apr 20 00:43:25 2014 -0400
proper use of fmt.Errorf
commit 43dad6acc0cb21aac2b04ce074699879898ee820
Author: Evan Hazlett <ejhazlett@gmail.com>
Date: Sun Apr 20 00:36:45 2014 -0400
proper placement of defer
commit b7f20b934b2bc92cd39397dbc608b77bff28493c
Author: Evan Hazlett <ejhazlett@gmail.com>
Date: Sun Apr 20 00:34:39 2014 -0400
defers, error checking, panic avoidance
commit 7a9a6ff267f8806dfe6676486f73fe89b72968fb
Author: Evan Hazlett <ejhazlett@gmail.com>
Date: Sun Apr 20 00:22:00 2014 -0400
data param to use container info instead of host
commit 0e0cf7309be1644687160d6519db792b23cd26e9
Author: Evan Hazlett <ejhazlett@gmail.com>
Date: Sun Apr 20 00:11:29 2014 -0400
added stats for cpuacct, memory, and blkio
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-04-20 11:34:28 -07:00
Michael Crosby
810cf722cc
Add remove method to subsystems
...
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-04-18 22:17:31 -07:00
Michael Crosby
bb89b83c68
Break down groups into subsystems
...
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-04-18 22:10:30 -07:00
Michael Crosby
8cc8aca9cc
Move raw cgroups into fs package (filesystem)
...
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-04-18 21:34:26 -07:00
Michael Crosby
9f508e4b3e
Move systemd code into pkg
...
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-04-18 21:30:08 -07:00
Michael Crosby
a183681b1d
Refactor cgroups file locations
...
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-04-18 21:14:58 -07:00
Michael Crosby
f95367f57f
Ignore not exist errors for joining default subsystems
...
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-04-14 00:07:48 +00:00
Alexander Larsson
e5ba166e75
Join memory and cpu cgroup in systemd too
...
Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: crosbymichael)
2014-04-11 17:29:40 +00:00
Michael Crosby
1dd3c38cb5
Join cpuacct, freezer, perf_event, and blkio groups
...
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-04-11 17:28:27 +00:00
Michael Crosby
27ceac34af
Setup cgroups for all subsystems
...
Fixes #5117
Fixes #5118
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-04-11 17:28:27 +00:00
Kevin Wallace
cba2eef566
Allow non-privileged containers to create device nodes.
...
Such nodes could already be created by importing a tarball to a container; now
they can be created from within the container itself.
This gives non-privileged containers the mknod kernel capability, and modifies
their cgroup settings to allow creation of *any* node, not just whitelisted
ones. Use of such nodes is still controlled by the existing cgroup whitelist.
Docker-DCO-1.1-Signed-off-by: Kevin Wallace <kevin@pentabarf.net> (github: kevinwallace)
2014-04-03 18:44:13 +00:00
Michael Crosby
ffa86e398a
Fix compile and unit test errors after merge
...
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-03-27 08:25:01 +00:00
Michael Crosby
42be9fb9d2
Merge branch 'master' into pluginflag
...
Conflicts:
pkg/cgroups/cgroups.go
pkg/libcontainer/nsinit/exec.go
pkg/libcontainer/nsinit/init.go
pkg/libcontainer/nsinit/mount.go
runconfig/hostconfig.go
runconfig/parse.go
runtime/execdriver/driver.go
runtime/execdriver/lxc/lxc_template.go
runtime/execdriver/lxc/lxc_template_unit_test.go
runtime/execdriver/native/default_template.go
runtime/execdriver/native/driver.go
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-03-27 08:00:18 +00:00
Alexander Larsson
33fab479ef
cgroups: Add systemd implementation of cgroups
...
This implements cgroup.Apply() using the systemd apis.
We create a transient unit called "docker-$id.scope" that contains
the container processes. We also have a way to set unit specific
properties, currently only defining the Slice to put the
scope in.
Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
2014-03-27 22:44:31 +01:00
Alexander Larsson
7cd539bc3d
cgroups: Join groups by writing to cgroups.procs, not tasks
...
cgroups.procs moves all the threads of the process, and "tasks" just
the one thread. I believe there is a risk that we move the main thread,
but then we accidentally fork off one of the other threads if the go
scheduler randomly switched to another thread. So, it seems safer (and
more correct) to use cgroups.procs.
Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
2014-03-27 21:47:47 +01:00
Alexander Larsson
fce532280b
cgroups: Splity out Apply/Cleanup to separate file/interface
...
This leaves only the generic cgroup helper functions in cgroups.go and
will allow easy implementations of other cgroup managers.
This also wires up the call to Cleanup the cgroup which was missing
before.
Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
2014-03-27 21:47:47 +01:00
Michael Crosby
cb12e80969
Add cpuset.cpus to cgroups and native driver options
...
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-03-24 05:33:11 +00:00
Michael Crosby
d8025d1066
Fix cgroups swap issue when it is not supported
...
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-02-25 19:45:57 -08:00
Michael Crosby
d388db815c
Look for cpu subsystem instead of memory
...
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-02-24 10:46:20 -08:00
Michael Crosby
ccc915b7b9
Move rest of cgroups functions into cgroups pkg
...
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-02-21 14:56:16 -08:00
Michael Crosby
1cecb00003
Refactory cgroups into general pkg
...
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-02-21 14:56:16 -08:00
Alexander Larsson
3de41b34a2
libcontainer: Initial version of cgroups support
...
This is a minimal version of raw cgroup support for libcontainer.
It has only enough for what docker needs, and it has no support
for systemd yet.
Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
2014-02-21 14:56:16 -08:00
Alexander Larsson
455aa20483
execdriver: Make GetPidsForContainer() a driver call
...
The current implementation is lxc specific.
Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
2014-01-28 16:21:49 +01:00
Paul Nasrat
1e4c9aed91
Don't expose cgroups via the execdriver API.
...
Use Resources to represent container limits rather than a cgroup specific field.
Docker-DCO-1.1-Signed-off-by: Paul Nasrat <pnasrat@gmail.com> (github: pnasrat)
2014-01-20 17:06:24 -05:00
Paul Nasrat
13860a3ba9
Extract cgroups pkg.
...
Initial move before enhancing cgroups package.
Docker-DCO-1.1-Signed-off-by: Paul Nasrat <pnasrat@gmail.com> (github: pnasrat)
2014-01-20 14:15:44 -05:00