Commit Graph

152 Commits

Author SHA1 Message Date
Ma Shimiao 3a788dd7f3 croup cpu: add support for realtime throttling
Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
2015-05-14 20:46:39 +08:00
Victor Marmol a37b2a4f15 Merge pull request #476 from hqhq/hq_dont_fail_subsystem
don't fail when subsystem not mounted
2015-05-11 09:29:59 -07:00
Qiang Huang e5a7aad7eb Replace aliased imports of logrus
Docker already did this: https://github.com/docker/docker/issues/11762
libcontainer should also do it.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2015-05-06 21:14:04 +08:00
Andrey Vagin 08af005e6b Use logrus everywhere
Signed-off-by: Andrey Vagin <avagin@openvz.org>
2015-05-01 18:41:28 +03:00
Qiang Huang 36633d3cb4 remove unused functions
Seems no one is using them.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2015-04-28 09:20:32 +08:00
Andrey Vagin 755bc77482 cgroups/systemd: remove useless code
I think the remove code and devices.Set do the same things.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
2015-04-28 00:00:24 +03:00
Alexander Morozov 984ec36fa1 Merge pull request #539 from Mashimiao/cgroups-add-support-for-blkio-throttle
cgroups: add support blkio.throttle.read/write_*
2015-04-27 10:34:45 -07:00
Michael Crosby b806655f91 Merge pull request #492 from Mashimiao/cgroup-add-support-for-device-deny
cgroups: add support of devices deny for another use of cgroup devices
2015-04-22 18:43:22 -07:00
Qiang Huang 27d3dd3df3 don't fail when subsystem not mounted
We do this aim two goals:
 - don't fail when some subsystems are not mounted (devices cgroup
   is an exception because it will cause secirity issues).
 - fail hard instead of ignoring the error when a user specifies
   an option and we are unable to fulfill the request.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2015-04-22 10:18:22 +08:00
bin liu 4a2ae107c8 fix some typos in source code comments
Signed-off-by: bin liu <liubin0329@gmail.com>
2015-04-20 02:35:51 +00:00
Ma Shimiao 59eb58b640 cgroups: add support blkio.throttle.read/write_*
Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
2015-04-17 16:03:42 +08:00
Qiang Huang e161ceccbe cleanup duplicate code for cpuShares check
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2015-04-17 13:18:44 +08:00
Ma Shimiao 689afbcf66 cgroups: add support for devices deny
Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
2015-04-16 08:30:22 +08:00
Alexander Morozov 84f43cdfac Merge pull request #500 from hqhq/hq_add_set_for_systemd
add Set support for systemd based cgroup
2015-04-15 12:23:39 -07:00
Alexander Morozov fc470e199d Merge pull request #464 from shishir-a412ed/cpu_shares_issue
Throw an error if cgroup tries to set cpu-shares more/less than the maximum/minimum permissible value.
2015-04-14 09:04:31 -07:00
Ma Shimiao dfbea73df4 add cgroup subsystem hugetlb
Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
2015-04-11 09:03:08 +08:00
jianbosun 2c3949a687 Change memory usage by minus cache memory
Signed-off-by: Sun Jianbo <wonderflow@zju.edu.cn>

Add stats.cache into MemoryStats

add cache to the output then client can clarify the results.

Signed-off-by: Sun Jianbo <wonderflow@zju.edu.cn>

Do not subtract cache from usage

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2015-04-09 13:18:46 -07:00
Qiang Huang 054d8e02bf cgroups: add support for blkio.weight_device
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2015-04-08 14:11:29 +08:00
Qiang Huang f9a0d21fab cleanup for systemd cgroup
Add join function so we can reduce duplicate code, and we can
call Set api in fs cgroup, that can reduce sync work on fs side
and systemd side.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2015-04-02 11:00:35 +08:00
Qiang Huang 4c2886d59a don't change state if systemd freeze failed
It has been fixed in fs base cgroup, but missed in systemd based.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2015-04-02 10:22:38 +08:00
Qiang Huang 55dd96592b add Set support for systemd based cgroup
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2015-04-02 09:57:04 +08:00
Shishir Mahajan 4e65e0e90a Throw an error if cgroup tries to set cpu-shares more/less than the maximum/minimum permissible value.
Signed-off-by: Shishir Mahajan <shishir.mahajan@redhat.com>
2015-04-01 11:25:13 -04:00
Ma Shimiao 8961fd20e6 cgroups/systemd: Use unified subsystems
Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
2015-04-01 12:04:54 +08:00
Ma Shimiao 0eb8a1aac3 cgroups: reurn error when passing invalid argument to freezer
Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
2015-04-01 00:04:33 +08:00
Mrunal Patel c851275416 Merge pull request #489 from philips/stop-test-unit
cgroups: systemd: attempt to stop test scope, if any
2015-03-30 17:55:21 -05:00
Alexander Morozov dc82e30089 Fix finding parent for fs cgroups
It was just supposed, that parent always like /root/subsystem, but it
can be /root/subsystem1,subsystem2

Fixes docker/docker#10690

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-03-30 14:12:15 -07:00
Brandon Philips 9e787db1b1 cgroups: systemd: attempt to stop test scope, if any
As reported in #477 the test scope may not be cleaned up between runs.
In order to fix this we must be polite and remove the scope after we
have done our test and attempt to remove an existing scope if it exists.
This way we can guarantee our test will run.

Signed-off-by: Brandon Philips <brandon.philips@coreos.com>
2015-03-25 18:15:35 -04:00
Qiang Huang 7766c1e07b remove redundant code
Now we return not found err in path(), so no need to check again.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2015-03-24 09:19:40 +08:00
Michael Crosby c5eef90460 Add back check for mountpoint to return consistent error
Adding this check here allows a nice error displaying that the specified
cgroup subsystem is not mounted.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2015-03-23 13:32:00 -07:00
Michael Crosby fc3981ea5c Revert "cgroups: only return path when subsystem really mounted"
This reverts commit 606d9064b0.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2015-03-23 13:31:42 -07:00
Michael Crosby c099a20eb8 path now returns the IsNotFound error
This error is not propogated up to the caller and needs to be handled at
the site where d.path() is called.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2015-03-23 11:32:09 -07:00
Pavel Tikhomirov dc4bd4cece systemd: properly check DefaultDependencies is read only
on systemd v208 in Centos7 and Fedora20 error is not:
"org.freedesktop.DBus.Error.PropertyReadOnly"
but:
"property.org.freedesktop.DBus.Error.PropertyReadOnly"
so check failes and in Docker we get:
Docker daemon: System error: Cannot set property DefaultDependencies, or
unknown property

Fix for commit:
99233fde8c

Signed-off-by: Pavel Tikhomirov <ptikhomirov@parallels.com>
2015-03-23 09:44:15 +03:00
Vishnu Kannan 9bebc66042 Do not fail cgroups setup if parent cgroup does not exist.
Docker-DCO-1.1-Signed-off-by: Vishnu Kannan <vishnuk@google.com> (github: vishh)
2015-03-16 21:09:37 +00:00
Michael Crosby 9387ebb6ba Merge pull request #437 from hqhq/hq_fix_some_cgroups_issues
fix some cgroups issues
2015-03-10 14:04:10 -07:00
Qiang Huang 35c01f9eb3 add Set memoryswap test cases
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2015-03-09 10:25:12 +08:00
Qiang Huang a3b0209cc6 cgroups: don't use d.path for cgroup tests files
d.path() should be used to get the real cgroup path, for temp path,
we can just create one.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2015-03-09 09:32:02 +08:00
Qiang Huang 606d9064b0 cgroups: only return path when subsystem really mounted
If cgroup patch doesn't exist, there is no point we do the Set.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2015-03-09 09:16:56 +08:00
Rohit Jnagal 074441b495 Merge pull request #429 from hqhq/hq_use_FindCgroupMountRoot
fix apply error when we not mount cpu subsystem
2015-03-06 10:11:16 -08:00
HuKeping 4332ffcfc6 cgroups: add test for disable oom killer
Signed-off-by: Hu Keping <hukeping@huawei.com>
2015-03-07 02:49:34 +08:00
HuKeping 295c70865d cgroups: add support for oom control
This patch add support for diable OOM Killer.

Signed-off-by: Hu Keping <hukeping@huawei.com>
2015-03-07 02:49:31 +08:00
Qiang Huang 07db66a6ef fix apply error when we not mount cpu subsystem
Find cgroup mountpoint dir through a specific subsystem is not reliable,
we don't know which subsystem users will or will not mount, we can't
assume that, only we can assume is that users mount cgroup subsystems
on the same dir.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2015-03-05 10:21:52 +08:00
Qiang Huang a8a798a7c9 cgroups: use Set instead of Apply in Freeze
So Apply function of freezer can be as sample as other subsystems.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2015-03-04 13:45:44 +08:00
Qiang Huang 4077c254a6 add test cases for Set interfaces
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2015-03-04 08:43:59 +08:00
Qiang Huang 74005ed4e0 add function to get string value from cgroup file
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2015-03-04 08:42:56 +08:00
Qiang Huang 1db687f4f4 add Set api
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2015-03-04 08:42:35 +08:00
Qiang Huang cc524f1b72 add Set interface
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2015-03-04 08:42:04 +08:00
Qiang Huang 12a63757db rename Set to Apply
The name `Set` would be used to do dymanic changes of resource configs
in the future. For now, `Apply` also makes more sense.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2015-03-04 08:37:55 +08:00
Alexander Morozov dd5576b2b3 Implement stats for systemd
It looks weird but works and not crashes application.

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-03-02 14:36:09 -08:00
Michael Crosby 22df5551ed Merge branch 'master' into api
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Conflicts:
	cgroups/systemd/apply_systemd.go
2015-02-19 16:02:50 -08:00
Michael Crosby f4cf808a3d Merge branch 'master' into api
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Conflicts:
	MAINTAINERS
	cgroups/cgroups.go
	cgroups/fs/apply_raw.go
	cgroups/fs/notify_linux.go
	cgroups/fs/notify_linux_test.go
	cgroups/systemd/apply_systemd.go
	config.go
	configs/config_test.go
	console/console.go
	integration/exec_test.go
	integration/init_test.go
	integration/template_test.go
	integration/utils_test.go
	linux_notify.go
	linux_notify_test.go
	mount/init.go
	mount/mount_config.go
	mount/pivotroot.go
	mount/ptmx.go
	namespaces/create.go
	namespaces/exec.go
	namespaces/execin.go
	namespaces/init.go
	namespaces/nsenter/nsenter.c
	namespaces/nsenter/nsenter.go
	namespaces/utils.go
	network/network.go
	network/types.go
	network/veth.go
	notify_linux.go
	notify_linux_test.go
	nsinit/exec.go
	nsinit/main.go
	nsinit/nsenter.go
	nsinit/oom.go
	sample_configs/host-pid.json
	sample_configs/userns.json
	security/capabilities/capabilities.go
	update-vendor.sh
2015-02-16 15:09:42 -08:00