lxc-info: Port to LXC API

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
lxc-info: Allow printing IP addresses

This adds a new -i flag to lxc-info to print the container's IP
addresses using get_ips().

Example:
$ lxc-info -n lxc-dev -s -p -i
state:  RUNNING
pid:    21331
ip:     10.0.3.165
ip:     2607:f2c0:f00f:2751:e9ca:842f:efa9:97d1
ip:     2607:f2c0:f00f:2751:216:3eff:fe3a:f1c1

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
Automatic mounts: improvements for /proc and /sys

Improve lxc.mount.auto code: allow the user to specify whether to mount
certain things read-only or read-write. Also make the code much more
easily extensible for the future.

Signed-off-by: Christian Seiler <christian@iwakd.de>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Automatic mounting: write lxc.mount.auto in write_config

Signed-off-by: Christian Seiler <christian@iwakd.de>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Automatic mounting: add more ways to mount the cgroup filesystem

This adds quite a few more ways to mount the cgroup filesystem
automatically:

 - Specify ro/rw/mixed:
       - ro: everything mounted read-only
       - rw: everything mounted read-write
       - mixed: only container's own cgroup is rw, rest ro
                (default)
 - Add cgroup-full that mounts the entire cgroup tree to the
   corresponding directories. ro/rw/mixed also apply here.

Signed-off-by: Christian Seiler <christian@iwakd.de>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Automatic mounting: document options in lxc.conf(5) manpage

Signed-off-by: Christian Seiler <christian@iwakd.de>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
valgrind: fix small leak in cgroup

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Fix typo

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Fix crasher in get_ips

Check that the interface structure is not NULL before trying to access
its members.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
add c->may_control

This is an api function which will return false if the container
is running, and the caller may not talk to its monitor over its
command socket.  Otherwise - if the container is not running, or
the caller may access it - it returns true.

We can use this in several tools early on to prevent the segvs
etc which we currently get.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
tests/getkeys: return 0 on success

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
RFC: lxclock: drop the chown+chmod of lockdir

The original rationale for this was to make sure that if
lxcpath was /home/serge/lxcbase, then then lockdir
(/run/user/serge/lock/lxc/home/serge/lxcbase) would be
owned by the same user as /home/serge/lxcbase.

The only user who can chown to other uids (without CAP_CHOWN
added to fP) is root, who shouldn't be mucking with non-root
owned containers anyway.  In the meantime this causes a bunch
of noise for arguably no benefit.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
refactor string conf items into common function

- When doing the selinux change, I noticed that there was a lot of
  duplication of code in handing string configuration items, so I
  refactored this into a common function.

- Added a config_string_max that can be passed a maximum acceptable
  length, used to limit ttydir to NAME_MAX.

- The behavior of config_seccomp was different than other strings: if the
  item was already defined, then the second attempt to set it would fail
  instead of just replacing the value. Changed to just replace the value.

- Remove unused key and lxc_conf arguments to config_path_item().

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
doc: Update Japanese man pages translation

* sync current English man pages on master branch
* delete lxc-shutdown.sgml.in
* add lxc-snapshot.sgml.in
* update FSF address (same as 250b1eec71b074acdff1c5f6b5a1f0d7d2c20b77)
* remove trailing whitespaces in legacy/lxc-ls.sgml.in (same as 8900b9eb2514c07047541833286428572493a9fd)
doc: Update Japanese lxc-info(1) man page

Add description of '-i' option
doc: Update Japanese lxc.conf(5) man page

Add description of automatic mounting options