Commit graph

1019 commits

Author SHA1 Message Date
Alexander Larsson
c49c2a7df5 pkg/units: Add FromHumanSize
This does the "reverse" of HumanSize, i.e. maps a string to an int64
using SI prefixes for the extension.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
2014-06-05 10:02:37 +02:00
Michael Crosby
cd85dac87e Exclude the user namespace for setns
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-06-04 18:03:17 -07:00
Michael Crosby
9b830f613d Move env load to nsenter
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-06-04 17:54:00 -07:00
Victor Marmol
985fe60646 Adding initial version of C-based nsenter for allowing execin in
libcontainer.

Docker-DCO-1.1-Signed-off-by: Victor Marmol <vmarmol@google.com> (github: vmarmol)
2014-06-05 00:44:13 +00:00
Michael Crosby
0a67ddd8c9 Rename nsinit package to namespaces in libcontainer
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-06-04 15:47:57 -07:00
Michael Crosby
14e8794741 Merge pull request #6198 from vishh/stats2
Add more stats to libcontainer.
2014-06-04 15:28:19 -07:00
Vishnu Kannan
59c33dfe0b Add stats for memory allocation failure count and instantaneous cpu usage in the usermode and kernelmode.
Docker-DCO-1.1-Signed-off-by: Vishnu Kannan <vishnuk@google.com> (github: vishh)
2014-06-04 21:20:21 +00:00
Victor Vieux
ae0b8c7d9d implement wait on freeze
Docker-DCO-1.1-Signed-off-by: Victor Vieux <vieux@docker.com> (github: vieux)
2014-06-04 02:21:10 +00:00
Victor Vieux
313ab78d1f Merge pull request #6183 from crosbymichael/fix-freezer-fs
Don't rejoin the freezer cgroup each time
2014-06-03 16:16:58 -07:00
Victor Vieux
29c3f75c27 Merge pull request #6180 from unclejack/apparmor
apparmor: write & load the profile on every start
2014-06-03 15:56:28 -07:00
Michael Crosby
82ec5cb036 Don't rejoin the cgroup each time
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-06-03 15:24:30 -07:00
unclejack
33381db09d apparmor: write & load the profile on every start
Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
2014-06-04 00:56:35 +03:00
Michael Crosby
2616e87cad Implement systemd support for freezer
These PR does a few things.  It ensures that the freezer cgroup is
joined in the systemd driver.  It also provides a public api for setting
the freezer state via the cgroups package.
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-06-03 10:46:53 -07:00
Alexander Larsson
cfde39c592 libcontainer/cgroup: Use raw access to set up and join the devices cgroup
The systemd support for the devices cgroup lacks two required features:
 * Support for wildcards to allow mknod on any device
 * Support for wildcards to allow /dev/pts support

The second is available in more recent systemd as "char-pts", but not in e.g. v208 which is in wide use.

Additionally, the current approach of letting systemd set up the devices cgroup and then adding
some devices to it doesn't work, because some times systemd (at least v208) re-initializes
the devices cgroup, overwriting our custom devices. See https://github.com/dotcloud/docker/issues/6009
for the details.

When wildcarded mknod support is available in systemd we should implement a pure systemd version,
but we need to keep the old one around for backwards compat.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
2014-06-03 11:34:14 +02:00
Victor Marmol
460e9bcc04 Merge pull request #6153 from vishh/stats1
Add per cpu usage to libcontainer  stats
2014-06-02 17:53:17 -07:00
Victor Vieux
41bdc33843 Merge pull request #6160 from crosbymichael/update-test-for-nil-error
Update cpu stat test for no error
2014-06-02 12:12:49 -07:00
Victor Vieux
bb7ac3e05b Merge pull request #6147 from cyphar/6142-mflag-strip-quotes-long-equal-form
mflag: strip quotes in certain forms from flag values
2014-06-02 12:03:58 -07:00
Michael Crosby
3a5c4516f9 Update cpu stat test for no error
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-06-02 11:54:23 -07:00
Solomon Hykes
1b7845224d Fix format in maintainers files
Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
2014-06-02 07:05:06 +00:00
Solomon Hykes
ab3832aabc Add Cristian as maintainer to pkg/testutils
Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
2014-06-02 07:01:17 +00:00
Vishnu Kannan
8610e96a03 Adding percpu usage to cgroup stats reported by libcontainer.
Docker-DCO-1.1-Signed-off-by: Vishnu Kannan <vishnuk@google.com> (github: vishh)
2014-06-02 06:56:15 +00:00
Vishnu Kannan
3589181812 Adding "stats" and "spec" option to nsinit binary which will print the stats and spec respectively.
Docker-DCO-1.1-Signed-off-by: Vishnu Kannan <vishnuk@google.com> (github: vishh)
2014-06-02 06:37:22 +00:00
cyphar
c3e6f79cb3 pkg: mflag: flag: added tests for quote-stripped flags
This patch adds some tests to ensure that quoted flags are properly
handled by the mflag package.

Docker-DCO-1.1-Signed-off-by: Aleksa Sarai <cyphar@cyphar.com> (github: cyphar)
2014-06-02 15:25:38 +10:00
cyphar
4941e364a9 pkg: mflag: flag: make mflag strip quotes in -flag="var" forms
This patch improves the mflag package to ensure that things arguments
to mflag such as `-flag="var"` or `-flag='var'` have the quotes
stripped from the value (to mirror the getopt functionality for similar
flags).

Docker-DCO-1.1-Signed-off-by: Aleksa Sarai <cyphar@cyphar.com> (github: cyphar)
2014-06-02 15:25:33 +10:00
Solomon Hykes
6f2458c40c pkg/testutils: utility functions to facilitate writing Go tests
Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
2014-06-01 23:23:31 +00:00
unclejack
1a38e6ff10 Merge pull request #6128 from crosbymichael/empty-sqlite
Init database if empty file
2014-05-31 06:56:00 +03:00
Michael Crosby
084c621c66 Ensure all dev nodes are copied for privileged
This also makes sure that devices are pointers to avoid copies
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-05-30 18:39:11 -07:00
Michael Crosby
edadb42c99 Init database if empty file
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-05-30 17:44:00 -07:00
unclejack
000552944e Merge pull request #6097 from timthelion/consistentdevices
Refactor device handling code
2014-05-31 03:34:52 +03:00
Victor Vieux
6d70b5e210 use stderr to debug iptables
Docker-DCO-1.1-Signed-off-by: Victor Vieux <vieux@docker.com> (github: vieux)
2014-05-30 19:39:42 +00:00
Timothy Hobbs
193f9894c0 Refactor device handling code
We now have one place that keeps track of (most) devices that are allowed and created within the container.  That place is pkg/libcontainer/devices/devices.go

This fixes several inconsistencies between which devices were created in the lxc backend and the native backend.  It also fixes inconsistencies between wich devices were created and which were allowed.  For example, /dev/full was being created but it was not allowed within the cgroup.  It also declares the file modes and permissions of the default devices, rather than copying them from the host.  This is in line with docker's philosphy of not being host dependent.

Docker-DCO-1.1-Signed-off-by: Timothy Hobbs <timothyhobbs@seznam.cz> (github: https://github.com/timthelion)
2014-05-30 19:21:29 +00:00
Alexandr Morozov
d9882a62ff Atomically increment sequence in pkg/netlink
Docker-DCO-1.1-Signed-off-by: Alexandr Morozov <lk4d4math@gmail.com> (github: LK4D4)
2014-05-30 16:08:29 +04:00
Vishnu Kannan
c7135d73d3 Added a new method cgroups.GetStats() which will return a cgroups.Stats object which will contain all the available cgroup Stats.
Remove old Stats interface in libcontainers cgroups package.
Changed Stats to use unit64 instead of int64 to prevent integer overflow issues.
Updated unit tests.

Docker-DCO-1.1-Signed-off-by: Vishnu Kannan <vishnuk@google.com> (github: vishh)
2014-05-29 20:16:49 +00:00
Michael Crosby
c22a0a3297 Merge pull request #6105 from gdm85/master
Do not consider iptables' output an error in case of xtables lock
2014-05-29 11:06:25 -07:00
Giuseppe Mazzotta
d68100ec34 * do not consider iptables' output an error in case of xtables lock
Docker-DCO-1.1-Signed-off-by: Giuseppe Mazzotta <gdm85@users.noreply.github.com> (github: gdm85)
2014-05-29 15:57:29 +02:00
Michael Crosby
e8727a6236 Handle EBUSY on remount
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-05-28 18:10:50 -07:00
Victor Vieux
1dd391fe26 Merge pull request #6083 from bernerdschaefer/nsinit-drop-capabilities-after-changing-user
SETUID/SETGID not required for changing user
2014-05-28 17:29:17 -07:00
Alexander Larsson
95a61f16dc libcontainer: Don't create a device node on /dev/console to bind mount on
There is no need for this, the device node by itself doesn't work, since
its not on a devpts fs, and we can just a regular file to bind mount over.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
2014-05-28 21:07:40 +02:00
Alexander Larsson
a193d05209 Revert "Remove the bind mount for dev/console which override the mknod/label"
This reverts commit ae85dd54582e94d36b146ab1688844ed58cc8df3.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
2014-05-28 21:07:27 +02:00
unclejack
2ca2e1b82a Merge pull request #6076 from LK4D4/remove_collections_package
Remove collections package
2014-05-28 21:32:27 +03:00
Victor Marmol
744a7c030c Merge pull request #5868 from jhspaybar/5749-libcontainerroutes
libcontainer support for arbitrary route table entries
2014-05-28 10:50:56 -07:00
William Thurston
755e5047a7 Fixes #5749
libcontainer support for arbitrary route table entries

Docker-DCO-1.1-Signed-off-by: William Thurston <me@williamthurston.com> (github: jhspaybar)
2014-05-28 17:42:02 +00:00
Bernerd Schaefer
906451091d SETUID/SETGID not required for changing user
It is no longer necessary to pass "SETUID" or "SETGID" capabilities to
the container when a "user" is specified in the config.

Docker-DCO-1.1-Signed-off-by: Bernerd Schaefer <bj.schaefer@gmail.com> (github: bernerdschaefer)
2014-05-28 16:41:48 +02:00
Bernerd Schaefer
b6ee193b8e Add system.SetKeepCaps and system.ClearKeepCaps
Docker-DCO-1.1-Signed-off-by: Bernerd Schaefer <bj.schaefer@gmail.com> (github: bernerdschaefer)
2014-05-28 16:40:36 +02:00
Alexandr Morozov
a09f2d1c41 Remove collections package
It doesn't needed anymore аfter port and ip allocators refactoring
Docker-DCO-1.1-Signed-off-by: Alexandr Morozov <lk4dmath@gmail.com> (github: LK4D4)
2014-05-28 13:59:45 +04:00
Michael Crosby
c8a8176936 Update wait calls to call Wait on Command
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-05-27 13:38:24 -07:00
unclejack
eb075733c5 Merge pull request #6025 from crosbymichael/concurrent-names
Improve name generation on concurrent requests
2014-05-27 23:18:19 +03:00
Erik Hollensbe
18d68cf1a9 libcontainer/nsinit: remove Wait call from Exec and Kill from Attach in tty_term.go
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
2014-05-27 12:26:56 -07:00
Erik Hollensbe
36bd5bf98b Add Wait() calls in the appropriate spots
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
2014-05-27 12:26:56 -07:00
Michael Crosby
47b9bba5e1 Improve name generation on concurrent requests
Fixes #2586

This fixes a few races where the name generator asks if a name is free
but another container takes the name before it can be reserved.  This
solves this by generating the name and setting it.  If the set fails
with a non unique error then we try again.
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-05-23 17:51:16 -07:00