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>
It was just supposed, that parent always like /root/subsystem, but it
can be /root/subsystem1,subsystem2
Fixesdocker/docker#10690
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
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>
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>
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>
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>
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>
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>
This allows you to set certian configuration options such as what cgroup
implementation to use on the factory at create time.
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
The root problem this fixes is the docker daemon uses DefaulDependencies
for all of its scopes which means that the containers get killed by
systemd before the docker daemon is notified to shutdown. This means
that a docker run in a service file won't get ordered properly on
shutdown! This has affected many CoreOS users and is documented in
systemd as so:
"Unless DefaultDependencies=false is used, scope units will implicitly
have dependencies of type Conflicts= and Before= on shutdown.target."
Unfortunately, systemd didn't allow setting DefaultDependencies=false on
transient units until today:
systemd-run --scope --property="DefaultDependencies=false" /usr/bin/sleep 50000
Unknown assignment DefaultDependencies=false.
Failed to create message: Invalid argument
Fixed here:
http://cgit.freedesktop.org/systemd/systemd/commit/?id=261420ba2a20305ad271b6f5f380aa74c5c9dd50
Discussion with systemd upstream:
http://lists.freedesktop.org/archives/systemd-devel/2014-December/026313.htmlhttp://lists.freedesktop.org/archives/systemd-devel/2015-February/027890.html
Tested with docker and systemd master as of today and it work for me.
Signed-off-by: Brandon Philips <brandon.philips@coreos.com>
Change the various config structs into one package and have a flatter
structure for easier use.
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
My previous patch moved the setting of the freezer state after the Set()
command. It's wrong, because this command uses it, so we need to set the
freezer state before the command and rollback it in an error case.
Fixes: 13a5703 ("cgroups: don't change a freezer state if an operation failed")
Signed-off-by: Andrey Vagin <avagin@openvz.org>
My previous patch moved the setting of the freezer state after the Set()
command. It's wrong, because this command uses it, so we need to set the
freezer state before the command and rollback it in an error case.
Fixes: 13a5703d85 ("cgroups: don't change a freezer state if an operation failed")
Signed-off-by: Andrey Vagin <avagin@openvz.org>