cgrules.conf(5): add information about templates setting in rules cgconfig.conf(5): add information about templates setting + example cgrulesengd(8): add information about SIGUSR1 signal which call reloads the templates configuration README_daemon: the same change as in cgrulesengd(8)
CHANGELOG: * cgrules.conf - incorporate Jan's feedback Signed-off-by: Ivana Hutarova Varekova <varek...@redhat.com> Acked-by: Jan Safranek<jsafr...@redhat.com> --- 0 files changed, 0 insertions(+), 0 deletions(-) diff --git a/README_daemon b/README_daemon index 17e4ea8..25f0d55 100644 --- a/README_daemon +++ b/README_daemon @@ -64,10 +64,14 @@ currently supported: --config [FILE] Read rules configuration from FILE instead of /etc/cgrules.conf -You can ask the daemon to reload the configuration by sending it SIGUSR2. The -easiest way to do this is with the 'kill' command: +You can ask the daemon to reload the rules configuration by sending it SIGUSR2. +The easiest way to do this is with the 'kill' command: kill -s SIGUSR2 [PID] +You can ask the daemon to reload the templates configuration by sending it +SIGUSR1. The easiest way to do this is with the 'kill' command: + kill -s SIGUSR1 [PID] + TESTING ======= The program setuid (found in tests/setuid.c) can help you test the daemon. By diff --git a/doc/man/cgconfig.conf.5 b/doc/man/cgconfig.conf.5 index fbcc978..be80e4e 100644 --- a/doc/man/cgconfig.conf.5 +++ b/doc/man/cgconfig.conf.5 @@ -239,6 +239,18 @@ their permissions in their .I group section. +.I template +section has the same structure as +.B group +section. Template name uses the same templates string as +.B cgrules.conf +destination tag (see (\fBcgrules.conf\fR (5)). +Template definition is used as a control group definition for rules in +\fBcgrules.conf\fR (5) with the same destination name. +Templates does not use +.B default +section settings. + .\"********************************************" .SH EXAMPLES .LP @@ -710,6 +722,48 @@ control group, but they can not move the process out of the group. Only the .I operator or root can do that. +.SS Example 7 +.LP +The configuration file: + +.LP +.RS +.nf +mount { +.RS +cpu = /mnt/cgroups/cpu; +cpuacct = /mnt/cgroups/cpuacct; +.RE +} + +group students { +.RS +cpuacct{ +} +cpu { +} +.RE +} + +template students/%u { +.RS +cpuacct{ +} +cpu { +} +.RE +} + +mkdir /mnt/cgroups/cpu/daemons +mkdir /mnt/cgroups/cpuacct/daemons +.fi +.RE + +The situation is the similar as in Example 4. The only difference is template, +which is used if some rule uses "/students/%u" as a destination. + + + .SH RECOMMENDATIONS .SS Keep hierarchies separated Having multiple hierarchies is perfectly valid and can be useful diff --git a/doc/man/cgexec.1 b/doc/man/cgexec.1 index fa131ce..3834a02 100644 --- a/doc/man/cgexec.1 +++ b/doc/man/cgexec.1 @@ -31,6 +31,14 @@ If this option is not used, \fBcgexec\fR will automatically place the task in the right cgroup based on \fB/etc/cgrules.conf\fR. +If \fB/etc/cgrules.conf\fR configuration file is used, there can be used +template names. Then the control group name contains +a template in destination tag (see \fBcgrules.conf\fR (5)) +and if the cgroup does not exist in execution time, +it is created, based on \fB/etc/cgconfig.conf\fR specification. +If the specifications are not present the group is created with the default +kernel values. + .TP .B -h, --help Display this help and exit. diff --git a/doc/man/cgrules.conf.5 b/doc/man/cgrules.conf.5 index 676f0cc..7a89fb5 100644 --- a/doc/man/cgrules.conf.5 +++ b/doc/man/cgrules.conf.5 @@ -56,7 +56,7 @@ can be: can be: .nf - path relative to the controller hierarchy (ex. pgrp1/gid1/uid1) - - following strings will get expanded + - following strings called "\fBtemplates\fR" and will get expanded %u username, uid if name resolving fails %U uid @@ -67,13 +67,25 @@ can be: '\\' can be used to escape '%' .fi - First rule which matches the criteria will be executed. - Any text starting with '#' is considered as a start of comment line and is ignored. +If the +.I destination +contains +.B template +string, the control group can be created on-fly. In time when some process wants +to use the template rule which leads to control group (see +\fBcgexec\fR (1)) and the control group does not exist, the group is created. The +template control group parameters can be specified in +.B cgconfig.conf +configuration file. See (\fBcgconfig.conf\fR (5)). +If the template definition is not found there created group have default +kernel setting. + + .SH EXAMPLES .nf @@ -110,6 +122,13 @@ the earliest matched rule is applied, it makes sense to have this line at the end of the list. It will put a task which was not mentioned in the previous rules to default/ control group. +.nf +@students cpu,cpuacct students/%u +.fi +Processes in cpu and cpuacct subsystems started by anybody from students group +belong to group students/name. Where "name" is user name of owner of the +process. + .SH FILES diff --git a/doc/man/cgrulesengd.8 b/doc/man/cgrulesengd.8 index 9093ea7..69be57f 100644 --- a/doc/man/cgrulesengd.8 +++ b/doc/man/cgrulesengd.8 @@ -15,6 +15,7 @@ the appropriate control group. The list of rules is read during the daemon startup is are cached in the daemon's memory. The daemon reloads the list of rules when it receives SIGUSR2 signal. +The daemon reloads the list of templates when it receives SIGUSR1 signal. The daemon opens a standard unix socket to receive 'sticky' requests from \fBcgexec\fR. ------------------------------------------------------------------------------ Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and much more. Get web development skills now with LearnDevNow - 350+ hours of step-by-step video tutorials by Microsoft MVPs and experts. SALE $99.99 this month only -- learn more at: http://p.sf.net/sfu/learnmore_122812 _______________________________________________ Libcg-devel mailing list Libcg-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libcg-devel