lxc-cgroup: use correct terminology

lxc-cgroup gets or sets the value of a state object (such as
'cpuset.cpus'), not the value of a subsystem (which would be
just 'cpuset').

Signed-off-by: David Ward <david.ward@ll.mit.edu>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
This commit is contained in:
David Ward 2012-05-04 00:50:15 +02:00 committed by Daniel Lezcano
parent 257e5824e4
commit f10e7166ab
3 changed files with 30 additions and 27 deletions

View File

@ -48,8 +48,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
<refsynopsisdiv>
<cmdsynopsis>
<command>lxc-start <replaceable>-n name</replaceable>
<replaceable>subsystem</replaceable> <optional>value</optional>
<command>lxc-cgroup -n <replaceable>name</replaceable>
<replaceable>state-object</replaceable> <optional>value</optional>
</command>
</cmdsynopsis>
</refsynopsisdiv>
@ -58,17 +58,20 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
<title>Description</title>
<para>
<command>lxc-cgroup</command> get or set value from the control
group associated with the
container <replaceable>name</replaceable>. If
no <optional>value</optional> is specified, the value of
the <replaceable>subsystem</replaceable> is displayed, otherwise
it is set. The <command>lxc-cgroup</command> does not assume the
correctness of the <replaceable>subsystem</replaceable> name, it
is up to the user to specify the
right <replaceable>subsystem</replaceable> name.
<command>lxc-cgroup</command> gets or sets the value of a
<replaceable>state-object</replaceable> (e.g., 'cpuset.cpus')
in the container's cgroup for the corresponding subsystem (e.g.,
'cpuset'). If no <optional>value</optional> is specified, the
current value of the <replaceable>state-object</replaceable> is
displayed; otherwise it is set.
</para>
<para>
Note that <command>lxc-cgroup</command> does not check that the
<replaceable>state-object</replaceable> is valid for the running
kernel, or that the corresponding subsystem is contained in any
mounted cgroup hierarchy.
</para>
</refsect1>
<refsect1>
@ -77,11 +80,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
<varlistentry>
<term>
<option><replaceable>subsystem</replaceable></option>
<option><replaceable>state-object</replaceable></option>
</term>
<listitem>
<para>
Specify the subsystem control group name.
Specify the state object name.
</para>
</listitem>
</varlistentry>
@ -92,7 +95,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
</term>
<listitem>
<para>
Specify the subsystem control group value to be set.
Specify the value to assign to the state object.
</para>
</listitem>
</varlistentry>

View File

@ -531,8 +531,8 @@ int lxc_cgroup_path_get(char **path, const char *subsystem, const char *name)
static char buf[MAXPATHLEN];
static char retbuf[MAXPATHLEN];
/* what lxc_cgroup_set calls subsystem is actually the filename, i.e.
'devices.allow'. So for our purposee we trim it */
/* lxc_cgroup_set passes a state object for the subsystem,
* so trim it to just the subsystem part */
if (subsystem) {
snprintf(retbuf, MAXPATHLEN, "%s", subsystem);
char *s = index(retbuf, '.');

View File

@ -36,7 +36,7 @@ lxc_log_define(lxc_cgroup_ui, lxc_cgroup);
static int my_checker(const struct lxc_arguments* args)
{
if (!args->argc) {
lxc_error(args, "missing cgroup subsystem");
lxc_error(args, "missing state object");
return -1;
}
return 0;
@ -49,13 +49,13 @@ static const struct option my_longopts[] = {
static struct lxc_arguments my_args = {
.progname = "lxc-cgroup",
.help = "\
--name=NAME subsystem [value]\n\
--name=NAME state-object [value]\n\
\n\
lxc-cgroup get or set subsystem value of cgroup\n\
associated with the NAME container\n\
Get or set the value of a state object (for example, 'cpuset.cpus')\n\
in the container's cgroup for the corresponding subsystem.\n\
\n\
Options :\n\
-n, --name=NAME NAME for name of the container",
-n, --name=NAME container name",
.options = my_longopts,
.parser = NULL,
.checker = my_checker,
@ -63,7 +63,7 @@ Options :\n\
int main(int argc, char *argv[])
{
char *subsystem = NULL, *value = NULL;
char *state_object = NULL, *value = NULL;
if (lxc_arguments_parse(&my_args, argc, argv))
return -1;
@ -72,15 +72,15 @@ int main(int argc, char *argv[])
my_args.progname, my_args.quiet))
return -1;
subsystem = my_args.argv[0];
state_object = my_args.argv[0];
if ((argc) > 1)
value = my_args.argv[1];
if (value) {
if (lxc_cgroup_set(my_args.name, subsystem, value)) {
if (lxc_cgroup_set(my_args.name, state_object, value)) {
ERROR("failed to assign '%s' value to '%s' for '%s'",
value, subsystem, my_args.name);
value, state_object, my_args.name);
return -1;
}
} else {
@ -88,10 +88,10 @@ int main(int argc, char *argv[])
int ret;
char buffer[len];
ret = lxc_cgroup_get(my_args.name, subsystem, buffer, len);
ret = lxc_cgroup_get(my_args.name, state_object, buffer, len);
if (ret < 0) {
ERROR("failed to retrieve value of '%s' for '%s'",
subsystem, my_args.name);
state_object, my_args.name);
return -1;
}