Commit Graph

4714 Commits

Author SHA1 Message Date
mgariepy
1c5a3c5854 create symlink for /var/run
this patch create /var/run link to point to /run.

This will fix various issue present when /var/run is persistent.

Signed-off-by: Marc Gariepy <gariepy.marc@gmail.com>
2016-11-08 12:19:42 -05:00
Serge Hallyn
f79750ace9 Merge pull request #1262 from brauner/2016-10-29/lxc_free_cgroup_sigsegv
cgfs: various fixes
2016-11-07 10:09:06 -07:00
Stéphane Graber
f5795427b1 Merge pull request #1275 from brauner/2016-11-04/unshare_cgroup_after_clone
start: CLONE_NEWCGROUP after we have setup cgroups
2016-11-03 15:27:37 -06:00
Christian Brauner
deefdf8a79
start: CLONE_NEWCGROUP after we have setup cgroups
If we do it earlier we end up with a wrong view of /proc/self/cgroup. For
example, assume we unshare(CLONE_NEWCGROUP) first, and then create the cgroup
for the container, say /sys/fs/cgroup/cpuset/lxc/c, then /proc/self/cgroup
would show us:

     8:cpuset:/lxc/c

whereas it should actually show

     8:cpuset:/

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
2016-11-03 21:41:46 +01:00
Christian Brauner
8813bb24f8 Merge pull request #1274 from tych0/check-state-before-checkpoint
c/r: check state before doing a checkpoint/restore
2016-11-03 14:38:42 -06:00
Tycho Andersen
7ad13c9123 c/r: check state before doing a checkpoint/restore
This would already fail, but with a not-as-good error message. Let's make
the error better.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
2016-11-03 12:01:09 -06:00
Christian Brauner
293eeeac72 Merge pull request #1273 from Blub/trivial/bin-bash-consistency
cleanup: /usr/bin/bash vs /bin/bash consistency
2016-11-03 06:54:06 -06:00
Wolfgang Bumiller
c5ec44f289 cleanup: /usr/bin/bash vs /bin/bash consistency
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2016-11-03 09:07:05 +01:00
Christian Brauner
b4b43e9e32 Merge pull request #1058 from hallyn/2016-06-24/eric.cgns
container start: clone newcgroup immediately
2016-11-02 19:56:28 -06:00
Christian Brauner
0fa988d1ac Merge pull request #1269 from Blub/phynet-rename-2
conf: merge network namespace move & rename on shutdown
2016-11-02 14:05:33 -06:00
Christian Brauner
59f1c5ca63 Merge pull request #1270 from tych0/save-dump-state-too
c/r: save dump stdout too
2016-11-02 12:05:15 -06:00
Tycho Andersen
2735dfae4c c/r: fix off-by-one error
When we read sizeof(buf) bytes here, we'd write off the end of the array,
which is bad :)

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
2016-11-02 15:59:00 +00:00
Tycho Andersen
9f1f54b0c5 c/r: remove extra \ns from logs
The macros put a \n in for us, so let's not put another one in.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
2016-11-02 15:10:13 +00:00
Tycho Andersen
5af85cb144 c/r: save criu's stdout during dump too
This also allows us to commonize some bits of the dup2 code.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
2016-11-02 15:04:56 +00:00
Wolfgang Bumiller
5610055a11 conf: merge network namespace move & rename on shutdown
On shutdown we move physical network interfaces back to the
host namespace and rename them afterwards as well as in the
later lxc_network_delete() step. However, if the device had
a name which already exists in the host namespace then the
moving fails and so do the subsequent rename attempts. When
the namespace ceases to exist the devices finally end up
in the host namespace named 'dev<ID>' by the kernel.

In order to avoid this, we do the moving and renaming in a
single step (lxc_netdev_move_by_*()'s move & rename happen
in a single netlink transaction).

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2016-11-02 14:59:44 +01:00
Stéphane Graber
52e129450e Merge pull request #1266 from tych0/do-mount-rewriting
Do mount rewriting
2016-10-31 17:34:57 -04:00
Tycho Andersen
ed408e6674 log: bump LXC_LOG_BUFFER_SIZE to 4096
We need to log longer lines due to CRIU arguments.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
2016-10-31 20:45:50 +00:00
Tycho Andersen
5f4e44a22d c/r: explicitly emit bind mounts as criu arguments
We switched to --ext-mount-map auto because of "system" (liblxc) added
mounts like the cgmanager socket that weren't in the config file. This had
the added advantage that we could drop all the mount processing code,
because we no longer needed an --ext-mount-map argument.

The problem here is that mounts can move between hosts. While
--ext-mount-map auto does its best to detect this situation, it explicitly
disallows moves that change the path name. In LXD, we bind mount
/var/lib/lxd/shmounts/$container to /dev/.lxd-mounts for each container,
and so when a container is renamed in a migration, the name changes.
--ext-mount-map auto won't detect this, and so the migration fails.

We *could* implement mount rewriting in CRIU, but my experience with cgroup
and apparmor rewriting is that this is painful and error prone. Instead, it
is much easier to go back to explicitly listing --ext-mount-map arguments
from the config file, and allow the source of the bind to change. We leave
--ext-mount-map auto to catch any stragling (or future) system added
mounts.

I believe this should fix Launchpad Bug 1580765

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
2016-10-31 20:45:50 +00:00
Stéphane Graber
a99e57fe9b Merge pull request #1264 from brauner/2016-10-30/fix_lxc_stop_exit_code
tools: use correct exit code for lxc-stop
2016-10-30 14:26:54 -04:00
Christian Brauner
dfef27a5a1
tools: use correct exit code for lxc-stop
When the container is already running our manpage promises to exit with 2.
Let's make it so.

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
2016-10-30 18:24:15 +01:00
Christian Brauner
517587ef58
cgfs: explicitly check for NULL
Somehow this implementation of a cgroupfs backend decided to use the hierarchy
numbers it detects in /proc/cgroups and /proc/self/cgroups as indices for
the hierarchy struct. Controller numbering usually starts at 1 but may start at
0 if:

    a) the controller is not mounted on a cgroups v1 hierarchy;
    b) the controller is bound to the cgroups v2 single unified hierarchy; or
    c) the controller is disabled

To avoid having to rework our fallback backend significantly, we should
explicitly check for each controller if hierarchy[i] != NULL.

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
2016-10-30 15:16:52 +01:00
Christian Brauner
82a2fe03a6
cgfs: skip empty entries under /proc/self/cgroup
If cgroupv2 is enabled either alone or together with legacy hierarchies
/proc/self/cgroup can contain entries of the form:

        0::/

These entries need to be skipped.

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
2016-10-30 14:49:50 +01:00
Christian Brauner
1a704014ee
cgfs: add print_cgfs_init_debuginfo()
Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
2016-10-30 14:49:43 +01:00
Christian Brauner
d93cd5478d Merge pull request #1261 from evgeni/lxc-ls-help-fixes
lxc-ls help fixes
2016-10-30 14:45:54 +01:00
Evgeni Golov
8b66257910 improve wording of the help page for lxc-ls
it's "list of columns", not "list of column"

Signed-off-by: Evgeni Golov <evgeni@debian.org>
2016-10-30 14:20:15 +01:00
Evgeni Golov
4ce07c451e improve help text for --fancy and --fancy-format
Signed-off-by: Evgeni Golov <evgeni@debian.org>
2016-10-30 14:16:38 +01:00
Christian Brauner
eff366245c Merge pull request #1260 from evgeni/find-obs-build-on-debian
find OpenSUSE's build also as obs-build
2016-10-30 13:40:57 +01:00
Evgeni Golov
f1fd15d693 find OpenSUSE's build also as obs-build
this is how it is shipped in Debian and Ubuntu

Signed-off-by: Evgeni Golov <evgeni@debian.org>
2016-10-30 13:32:59 +01:00
Stéphane Graber
c6e67838a3 Merge pull request #1259 from brauner/2016-10-29/lxc_free_cgroup_sigsegv
cgfs: fix invalid free()
2016-10-29 18:36:05 -04:00
Christian Brauner
2446c321cf
cgfs: fix invalid free()
And let's be on the safe side by NULLing free()ed variables.

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
2016-10-29 22:47:51 +02:00
Stéphane Graber
2ae2e35399 Merge pull request #1257 from evgeni/rpm-fixes
RPM build fixes
2016-10-29 14:40:04 -04:00
Evgeni Golov
bc39575656 fix rpm build, include all built files, but only once
Signed-off-by: Evgeni Golov <evgeni@debian.org>
2016-10-29 20:29:18 +02:00
Evgeni Golov
73bf276366 use python3_sitearch for including the python code
Closes: #502
Signed-off-by: Evgeni Golov <evgeni@debian.org>
2016-10-29 20:29:08 +02:00
Christian Brauner
ca1faa6822 Merge pull request #1252 from stgraber/master
Fix environment before importing setuptools
2016-10-26 01:53:17 +02:00
Stéphane Graber
c223a53622 Fix environment before importing setuptools
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2016-10-25 19:08:34 -04:00
Christian Brauner
ac94fda679 Merge pull request #1251 from stgraber/master
Tweak libtool handling to work with Android
2016-10-25 23:23:17 +02:00
Stéphane Graber
f4790f1f61 Tweak libtool handling to work with Android
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2016-10-25 16:40:21 -04:00
Christian Brauner
7d1937d093 Merge pull request #1248 from tych0/use-external
c/r: use external
2016-10-25 10:21:38 +02:00
Serge Hallyn
00afe6d90c Merge pull request #1249 from stgraber/master
ubuntu: Fix package upgrades requiring proc
2016-10-24 20:23:34 -05:00
Tycho Andersen
796a109dbe c/r: use snprintf to compute device name
This will never actually overflow, because %d is 32 bits and eth is 128
bytes long, but safety first :)

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
2016-10-24 16:58:06 -06:00
Tycho Andersen
f0b458e105 c/r: drop duplicate hunk from macvlan case
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
2016-10-24 16:55:27 -06:00
Stéphane Graber
e34466fe96 ubuntu: Fix package upgrades requiring proc
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2016-10-24 18:39:02 -04:00
Tycho Andersen
e269733002 c/r: add checkpoint/restore support for macvlan interfaces
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
2016-10-24 21:28:56 +00:00
Tycho Andersen
2f3fbc6bf3 c/r: remember to increment netnr
We need this for calculating the name of unnamed interfaces in the config.
But we also need to remember to increment it :)

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
2016-10-24 21:28:56 +00:00
Tycho Andersen
0f90d613ab c/r: use --external instead of --veth-pair
--veth-pair has been deprecated as of 2.6, let's use the new --external
instead.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
2016-10-24 21:28:56 +00:00
Christian Brauner
7fd5ab2afc Merge pull request #1245 from stgraber/master
Setup libtool
2016-10-22 01:20:46 +02:00
Stéphane Graber
26419a7a73 Use libtool for liblxc.so
This should allow proper filtering of build flags for libraries and make
it easier to use PIE/PIC.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2016-10-21 18:32:18 -04:00
Christian Brauner
4ab12dacef Merge pull request #1244 from Cypresslin/fix-lxc-copy-B
tools: correct the argument typo in lxc_copy
2016-10-21 13:05:39 +02:00
Po-Hsu Lin
3b0dcf2c76 tools: correct the argument typo in lxc_copy
Correct the backingstorage typo in lxc_copy.

Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
2016-10-21 18:32:18 +08:00
Christian Brauner
0fa4e360f8 Merge pull request #1243 from stgraber/master
s390x: Fix seccomp handling of personalities
2016-10-20 23:45:15 +02:00