Commit Graph

45 Commits

Author SHA1 Message Date
4188748bd6 Add ability to set cgroups freezer
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 5f6fda8cfd05dec002894d3e2214a04a58b62bed
Component: engine
2014-04-30 16:07:12 -07:00
fdcad5e0a4 Merge pull request #5476 from rjnagal/libcontainer-fixes
Cleanup cgroups on Set failures
Upstream-commit: bf59e6723274c6d20d7c78c683b5c8923a6d910e
Component: engine
2014-04-29 12:27:31 -07:00
3267a2a3bd Cleanup existing controllers when cleanup fails mid-way.
Docker-DCO-1.1-Signed-off-by: Rohit Jnagal <jnagal@google.com> (github: rjnagal)
Upstream-commit: 070747a21365959d3179d8df627d3e614318e202
Component: engine
2014-04-29 18:59:20 +00:00
d43500e59b Merge pull request #5455 from rjnagal/cgroup-stats
Add throttling stats for cpu cgroup
Upstream-commit: 69d56acd455de019cb324c4607c629be8d6fcad5
Component: engine
2014-04-28 17:53:37 -07:00
f2e5f328eb Another test to check for invalid stats.
Docker-DCO-1.1-Signed-off-by: Rohit Jnagal <jnagal@google.com> (github: rjnagal)
Upstream-commit: d724242297bf2981ad9c7745e5b130ab7fa8f067
Component: engine
2014-04-29 00:32:05 +00:00
28c69597af Add cpu throttling stats.
Docker-DCO-1.1-Signed-off-by: Rohit Jnagal <jnagal@google.com> (github: rjnagal)
Upstream-commit: 61f156d5215b2c9d38e26bbd732c6e9cb9a3208e
Component: engine
2014-04-29 00:18:18 +00:00
f9852087ba Adding a unit test for pkg/cgroup/fs/memory.go
Docker-DCO-1.1-Signed-off-by: Victor Marmol <vmarmol@google.com> (github: vmarmol)
Upstream-commit: 76f95294a316c1b545abe1fd17536da74779490b
Component: engine
2014-04-28 22:58:25 +00:00
243c5c4d55 Merge pull request #5412 from vmarmol/add-blkio-test
Adding a test for blkio stats.
Upstream-commit: b386f2f558693a6b2c3578e5b0d876585be60df2
Component: engine
2014-04-28 12:50:20 -07:00
2e76f7d9a4 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)
Upstream-commit: f4055ee2a467458d4848ad6f8e79fc0162d377f9
Component: engine
2014-04-26 07:29:13 +00:00
6e7ac095e3 Add memory usage and max usage stats.
Docker-DCO-1.1-Signed-off-by: Victor Marmol <vmarmol@google.com> (github: vmarmol)
Upstream-commit: ad924959a9879af7477fa23c19d570882c1f378f
Component: engine
2014-04-25 02:51:28 +00:00
69a18c6508 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)
Upstream-commit: f188b9f623e23ee624aca8654bf00f49ee3bae29
Component: engine
2014-04-24 11:09:38 -07:00
4a39371d62 Add support for cpu hardcapping to cgroups.
Docker-DCO-1.1-Signed-off-by: Rohit Jnagal <jnagal@google.com> (github: rjnagal)
Upstream-commit: 264dc8a46bb7f7679439d0a2c41c79a09642acab
Component: engine
2014-04-24 14:43:02 +00:00
7aff9b75c9 Use cgo to get systems clock ticks for metrics
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 004cf556e86a03d8961416b3e8a0a476a424b10f
Component: engine
2014-04-21 10:26:22 -07:00
f2dbe8f1d1 Refactor stat parsing to use only 8 fields
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: f59be989dc92503f29aa94ebf9ea4097ec28b8c9
Component: engine
2014-04-20 20:45:08 -07:00
3973334e17 work on cpu stats
Docker-DCO-1.1-Signed-off-by: Evan Hazlett <ejhazlett@gmail.com> (github: ehazlett)
Upstream-commit: 2f24b5a9dcc9ca5da07563fb0dd381e49ed844cc
Component: engine
2014-04-21 00:07:05 -04:00
d5fdf0aaaa 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)
Upstream-commit: bce49dff0d46dec620e755ed859efa791054a843
Component: engine
2014-04-20 18:35:33 -07:00
a0be7fcb46 Reuse cpuacct stats for cpu subsystem
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 3bfe13de2c38fda5b57e2499f474da701495c5ba
Component: engine
2014-04-20 18:20:44 -07:00
2f3e3558eb Fix parsing of blkio files
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 37248039e186f57768bb5c4fad23b1bca65448f7
Component: engine
2014-04-20 18:18:17 -07:00
030a007d36 Add external function to get cgroup stats
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 7f12260fd13329f3bafe4b42ad4193ff963bb1e2
Component: engine
2014-04-20 17:36:20 -07:00
af2fbf289d Refactor stats and add them to all subsystems
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 9b65f1635515fa35ed38f8a76b6d8f73ab3a1d02
Component: engine
2014-04-20 12:02:39 -07:00
1b76554adc 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)
Upstream-commit: 86e34ce59fb7f6e6e284a33f2538bafdc9114c89
Component: engine
2014-04-20 11:34:28 -07:00
112b738831 Add remove method to subsystems
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 7fdeda87173ee6722ef1cbe7b21a13ac8b173365
Component: engine
2014-04-18 22:17:31 -07:00
39b03cf53c Break down groups into subsystems
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: e92f2fd3950644a6e5eb38259cee9036648090cb
Component: engine
2014-04-18 22:10:30 -07:00
fec63c3950 Move raw cgroups into fs package (filesystem)
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 06db0604e5e5438dc14e13a069ebddcab7bb4bc6
Component: engine
2014-04-18 21:34:26 -07:00
91235494a6 Move systemd code into pkg
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: ec43ec50b44cff3f043c78cad97466c68e2ba8cd
Component: engine
2014-04-18 21:30:08 -07:00
0b62a2c5be Refactor cgroups file locations
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 42fb2973c690fe4e4f65da235ce4dfa4c388e8a3
Component: engine
2014-04-18 21:14:58 -07:00
fbaa43b382 Ignore not exist errors for joining default subsystems
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 184728e7bcf9af3224f53e8d5d38d44b08de24ec
Component: engine
2014-04-14 00:07:48 +00:00
5b7c5b263f 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)
Upstream-commit: 4ddfffcab3edf3d05ee8319e87410fe747979a04
Component: engine
2014-04-11 17:29:40 +00:00
9ba641b0ce Join cpuacct, freezer, perf_event, and blkio groups
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 505184d2dcb5d21834bcb2b108564fbdab733953
Component: engine
2014-04-11 17:28:27 +00:00
b455526c28 Setup cgroups for all subsystems
Fixes #5117
Fixes #5118
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 031fcb31d3a81fbd5c5ab8d898d53fbd486413e6
Component: engine
2014-04-11 17:28:27 +00:00
42964a36b7 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)
Upstream-commit: c94111b61988ad32d87f99d4421cbcde018c3fb4
Component: engine
2014-04-03 18:44:13 +00:00
5ed6e1adb8 Fix compile and unit test errors after merge
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 2d270c4f06dbc2ee1293e3f81f6922df248ef8eb
Component: engine
2014-03-27 08:25:01 +00:00
f4111a1ccb 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)
Upstream-commit: eab56ac007b263708b5526609c8be2bc19881467
Component: engine
2014-03-27 08:00:18 +00:00
5f846085d9 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)
Upstream-commit: 6c7835050e53b733181ddfca6152c358fd625400
Component: engine
2014-03-27 22:44:31 +01:00
cf568a7031 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)
Upstream-commit: 9294d7f2af6ecb7c18be11fb5043fad4a61d8f09
Component: engine
2014-03-27 21:47:47 +01:00
4a0326289d 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)
Upstream-commit: 7f7d8419a71d49b25e4d38196b36e93b568bb61d
Component: engine
2014-03-27 21:47:47 +01:00
9d6d07c6ea Add cpuset.cpus to cgroups and native driver options
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 9a7be1b015a1ba79e5480d0ddddfa5954b994507
Component: engine
2014-03-24 05:33:11 +00:00
f364b90f27 Fix cgroups swap issue when it is not supported
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 6016126c71272f7943458bbb8392dfd1f5877269
Component: engine
2014-02-25 19:45:57 -08:00
7ebf071730 Look for cpu subsystem instead of memory
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: a08e78a78c4b548919515fa7910db56990ef44dc
Component: engine
2014-02-24 10:46:20 -08:00
3b343c063f Move rest of cgroups functions into cgroups pkg
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 7020e208c70dfca5ebc97d699553e4bf1c6ab0bb
Component: engine
2014-02-21 14:56:16 -08:00
680db4b285 Refactory cgroups into general pkg
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: c44258630575f70231b11fb55bc4edc3fb677cab
Component: engine
2014-02-21 14:56:16 -08:00
d2ac05db40 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)
Upstream-commit: 664fc54e65ebc14ca9dd5bfc55e3dfe1796e51c8
Component: engine
2014-02-21 14:56:16 -08:00
4729a480ab 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)
Upstream-commit: 335bc39c9a5abfdbd07914ae1b8667a9d8590a6e
Component: engine
2014-01-28 16:21:49 +01:00
5de2521000 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)
Upstream-commit: 71c1646ba33da9b2567ad7a2f4cda0433c9718dd
Component: engine
2014-01-20 17:06:24 -05:00
c8d1294225 Extract cgroups pkg.
Initial move before enhancing cgroups package.

Docker-DCO-1.1-Signed-off-by: Paul Nasrat <pnasrat@gmail.com> (github: pnasrat)
Upstream-commit: 2553029959929184696e25ebdba4631ba7aeb8a6
Component: engine
2014-01-20 14:15:44 -05:00