1475 Commits

Author SHA1 Message Date
Dimitri John Ledkov 5774390b2d Refactor stage1/init to source most of options from manifest, rather than flavor/stampfile-based.
This refactor will make it easier to integrate lkvm support, and also
brings other benefits.

Specifically, with this refactor almost all functionality of stage1
init is flavor independent and can be fully controlled via a manifest
and uses as little hard coded paths as possible.

Thus, e.g. distribution packagers, can create package which will only
have rkt/stage1 provided binaries (gc, waiter, init, etc.) and specify
the rest of things in the manifest (path to nspawn, ld.so, LD LIBRARY
PATH, libfakesdbooted.so, etc). And create fully free-standing
stage1.aci by simply creating basic distribution chroot with
distro-native tools and supplying a matching/correct aci-manifest. By
fully free-standing, I mean similar to current coreos flavor, which is
completely independent of the host OS binaries & load paths and is
truly run everywhere.

Many of these refactors will be useful for future lkvm integration,
e.g. reusing ld.so load paths and similar.
2015-06-09 10:47:56 +01:00
Jonathan Boulle df4d7bd719 Merge pull request #1014 from jonboulle/master
*: fix appc links
2015-06-08 22:58:12 -07:00
Jonathan Boulle 99002346d6 *: fix appc links 2015-06-08 22:57:12 -07:00
Alban Crequy 196da8915b Merge pull request #1013 from endocode/alban/systemd_v219_refresh_patches
stage1: refresh systemd patches for v219
2015-06-08 22:41:02 +02:00
Alban Crequy ae9cdf168e stage1: refresh systemd patches for v219
With this change, the only patches applied on v219 are backports from systemd upstream:

https://github.com/systemd/systemd/commit/4f923a1984476de3441922ee5bf7102ebdd250ef
https://github.com/systemd/systemd/commit/47bc12e1ba35d38edda737dae232088d6d3ae688
https://github.com/systemd/systemd/commit/54b4755f15438c86991d5a4eaadc47150f7e5a84
https://github.com/systemd/systemd/commit/875e1014dd9d55cd0692dcce843598cffb2d09b0
https://github.com/systemd/systemd/commit/6b7d2e9ea4cdb4cfa1512d37548a1a967623d7f2

The patches in stage1/rootfs/usr_from_src/patches/v219/ have been tagged
with the "Origin" URL.

stage1/init/init.go is modified accordingly to avoid --keep-fd.

Fixes: #998
2015-06-08 18:26:56 +02:00
Alban Crequy 1960c9f3e0 Merge pull request #1003 from kibra/fix_ppid_when_using_private_net
stage1:init fix wrong ppid when using --private-net
2015-06-08 16:33:13 +02:00
Alban Crequy 8c64979101 Merge pull request #1007 from endocode/alban/fix-ostype
build: fix on OpenSUSE
2015-06-08 16:15:06 +02:00
Alban Crequy 70120a4b55 build: fix on OpenSUSE
$OSTYPE is "linux" on OpenSUSE 13.2. uname should be more reliable.

$OSTYPE was introduced for OS X in commit cb78269. Also, disable
functional tests on non-Linux.

Fixes: https://github.com/coreos/rkt/issues/1005
2015-06-08 15:31:02 +02:00
Iago López Galeiras 9bf931b9ee Merge pull request #1009 from endocode/iaguis/halt-target
stage1: add halt.target
2015-06-08 14:50:53 +02:00
Iago López Galeiras 819d3d3f81 stage1: add halt.target
When systemd-nspawn receives a TERM signal it will send it to systemd in
stage1 which will try to run the halt.target. This target was not
present in the current stage1 so the container was not being shut down.

Fix this by adding halt.target which calls reaper.service to shut down
the container cleanly.
2015-06-08 14:23:46 +02:00
Iago López Galeiras 30062ac541 Merge pull request #974 from iaguis/iaguis/gexpect
functional tests: capture output and print it on error
2015-06-08 12:34:12 +02:00
Iago López Galeiras c3bb4600ba functional tests: capture output and print it on error 2015-06-08 12:03:58 +02:00
Iago López Galeiras 2f4309c146 Godep: bump gexpect dependency
It allows to collect the output of a gexpect test so we can print it on
failures.
2015-06-08 12:03:58 +02:00
Kyle Ibrahim e5585a5239 stage1:init fix wrong ppid when using --private-net 2015-06-07 22:06:07 +00:00
Jonathan Boulle 7bf926e4fe Merge pull request #990 from endocode/iaguis/check-cgroups-before-enabling-them
stage1: take into account not-supported isolators
2015-06-05 10:10:04 -07:00
Iago López Galeiras e04ef0a43f stage1: add test for parseCgroups function
This commit modifies parseCgroups() to take an io.Reader as parameter
and adds a test for it.
2015-06-05 17:23:05 +02:00
Iago López Galeiras 3c211a5b38 Merge pull request #1001 from endocode/iaguis/journal-try-host
stage1: use --link-journal=try-host in systemd-nspawn
2015-06-05 16:13:04 +02:00
Iago López Galeiras 27ec47b2cd stage1: use --link-journal=try-host in systemd-nspawn
--link-journal=host fails if the host system doesn't have persistent
journaling enabled. Fix that by using "try-host"; if the system has
persistent journaling enabled it links the journal, otherwise it skips
the linking without exiting with a failure.

In 969a57c6 (stage1: use --link-journal=host instead of try-host) we
switched from "try-host" to "host" to support journal linking in systemd
versions <219 but now we don't support it on them anymore.
2015-06-05 15:43:28 +02:00
Alban Crequy 34ee76d07f Merge pull request #994 from jonboulle/master
build: update default systemd source location
2015-06-05 07:28:02 +02:00
Jonathan Boulle 62ea76fbcb build: update default systemd source location
systemd has now moved to GitHub
http://lists.freedesktop.org/archives/systemd-devel/2015-June/032738.html
https://github.com/systemd/systemd/commit/eb0914fc85812570538c37287dd3cfa377289418#diff-c47c7c7383225ab55ff591cb59c41e6bR11
2015-06-04 17:10:50 -07:00
Alban Crequy a65341b469 Merge pull request #993 from endocode/alban/semaphore-reorder
Functional tests, semaphore: reorder the tests
2015-06-04 18:20:57 +02:00
Alban Crequy 2fb807a14b Functional tests, semaphore: reorder the tests
Load balance the tests on the two VMs to have faster tests.
2015-06-04 18:18:16 +02:00
Iago López Galeiras 906ce611bd stage1: check if isolators are supported and warn if not
Warn the user if an isolator is requested but is not supported.
2015-06-04 18:11:00 +02:00
Iago López Galeiras 3eeb27ffbe stage1: refactor cgroup-related functions
Move them to a new cgroup.go file.
2015-06-04 18:11:00 +02:00
Iago López Galeiras d5a3f50306 stage1: mount cgroup file RW only if it exists
Some controller cgroup knob files can be disabled in kernel. If the
file we want doesn't exist, just ignore it when we bind-mount knobs over
themselves.
2015-06-04 18:11:00 +02:00
Alban Crequy 09a7efbb47 Merge pull request #992 from alban/alban/usr-merge
stage1, flavor usr-from-host: look in /usr/lib first
2015-06-04 18:10:48 +02:00
Alban Crequy 510930bf09 stage1, flavor usr-from-host: look in /usr/lib first
See:
http://www.freedesktop.org/wiki/Software/systemd/TheCaseForTheUsrMerge/
2015-06-04 17:57:12 +02:00
Alban Crequy 17762bf93c Merge pull request #977 from endocode/alban/flavor-host
Introduce new build flavor: usr-from-host
2015-06-04 16:56:59 +02:00
Alban Crequy 2824964937 stage1: add RKT_STAGE1_USR_FROM=usr-from-host 2015-06-04 16:33:45 +02:00
Alban Crequy da95867721 Godeps: add appc/goaci/proj2aci 2015-06-04 09:34:37 +02:00
Iago López Galeiras 1189d59c7d Merge pull request #987 from endocode/iaguis/mount-cgroup-files
stage1: bind-mount cgroup controller files RW
2015-06-03 19:29:17 +02:00
Iago López Galeiras 74075ab1d6 stage1: bind-mount cgroup controller files RW
Instead of bind-mounting the whole controller subcgroup directory RW we
only bind-mount the files we need to set isolators. This reduces the
cgroup attack surface.
2015-06-03 18:42:17 +02:00
Yifan Gu c4b57756a9 Merge pull request #978 from yifan-gu/fix_run_pod_manifest
rkt: Fix run --pod-manifest. Append image IDs to the stage0.RunConfig.
2015-06-03 09:02:21 -07:00
Iago López Galeiras ca8650d6fc Merge pull request #985 from endocode/iaguis/fix-parsecgroups
stage1: fix parseCgroups function
2015-06-03 16:35:12 +02:00
Iago López Galeiras c2c9ea9fc1 stage1: fix parseCgroups function
It wasn't taking into account if the cgroup controller was enabled or
not.
2015-06-03 16:07:46 +02:00
Iago López Galeiras 1d1e5ef397 Merge pull request #920 from endocode/iaguis/create-cgroups
stage1: support per-app memory and cpu isolators
2015-06-03 15:34:43 +02:00
Iago López Galeiras fd37804b9f functional tests: add isolators to the base image
This commit adds memory and cpu isolators to test we don't break
anything. The next step is adding a functional test that actually checks
the isolators are respected.
2015-06-03 14:47:55 +02:00
Iago López Galeiras 52213ca754 stage1: handle CPU isolator 2015-06-03 14:28:14 +02:00
Iago López Galeiras 9fb037d019 stage1: handle memory isolator 2015-06-03 14:28:14 +02:00
Iago López Galeiras 67c6c73a9e stage1: create cgroups before calling systemd-nspawn
To allow systemd inside stage1 to set resource limits for apps we mount
the cgroup controllers hierarchy in rkt. We need this because
systemd-nspawn mounts cgroup controllers as read-only.

We mimic systemd-nspawn cgroup mounts with the difference that we
bind-mount the apps' subdirectories over themselves so they stay
read-write. We leave the mounting of systemd's cgroup hierarchy to
nspawn.
2015-06-03 14:28:14 +02:00
Iago López Galeiras e26d71a880 common: add SliceToPath function
SliceToPath explodes a slice name to its corresponding path in the cgroup
hierarchy. For example, a slice named "foo-bar-baz.slice" corresponds to the
path "foo.slice/foo-bar.slice/foo-bar-baz.slice". See systemd.slice(5)

Since SliceToPath needs to do escapings and sanity checks, several
functions used in systemd for that purpose are also ported.
2015-06-03 14:21:03 +02:00
Iago López Galeiras fbf6a3757b stage0: enter a new mount namespace always
Previously we were only entering a mount namespace in rkt when we used
overlay fs. Since we now mount the cgroup controller hierarchy we enter
a new mount namespace it in every case.
2015-06-03 14:21:03 +02:00
Alban Crequy fee01d4224 Merge pull request #910 from endocode/alban/pid-file-parent
stage1: remove --pid-file patch from systemd-nspawn
2015-06-03 13:59:57 +02:00
Alban Crequy f063ec92c6 functional test: TestPidFile*: update to ppid 2015-06-03 12:58:10 +02:00
Alban Crequy 2c25275523 stage1: remove --pid-file patches from systemd-nspawn
Instead of asking systemd-nspawn to write its "pid" file, rkt can write
the parent pid "ppid". Then, update getPID() to get the pid file from
/proc/$ppid/task/$ppid/children. In this way, we don't need to patch
systemd-nspawn.

getPID() is able to read both the "pid" file and the "ppid" file, in
order to work with alternative stage1s which choose to implement one or
the other method.

coreos/rkt#910
2015-06-03 12:58:09 +02:00
Alban Crequy be40b0eb67 documentation: stage1 ABI for enter 2015-06-03 10:52:06 +02:00
Iago López Galeiras e7c054d8ff Merge pull request #976 from endocode/iaguis/bump-docker2aci
Godeps: bump docker2aci
2015-06-02 23:53:56 +02:00
Yifan Gu 88b77ea994 rkt: Fix run --pod-manifest. Append image IDs to the stage0.RunConfig. 2015-06-02 12:22:36 -07:00
Iago López Galeiras dbe39ba1c2 Godeps: bump docker2aci
It converts docker ports
2015-06-02 20:56:33 +02:00
Alban Crequy e58e40bf34 Merge pull request #973 from endocode/alban/functests_pidfilerace
Functional test: TestPidFileAbortedStart (pid file race)
2015-06-02 12:19:59 +02:00