Commit Graph

1276 Commits

Author SHA1 Message Date
Milos Gajdos 63cfaa86b3 Fixing Travis builds by allowing short tests.
Docker-DCO-1.1-Signed-off-by: Milos Gajdos <milosgajdos83@gmail.com> (github: milosgajdos83)
2014-09-20 03:36:08 +01:00
Milos Gajdos 4fe2c7a4db Refactored and added more tests.Cleaned up netlink.
I've added more tests. We now have almost 55% coverage.
I've also reorganized netlink_linux codebase and moved
the non-RTNETLINK functions at the bottom. I've also
added some comments to some functions.

Docker-DCO-1.1-Signed-off-by: Milos Gajdos <milosgajdos83@gmail.com> (github: milosgajdos83)
2014-09-20 03:11:26 +01:00
Michael Crosby 185328a426 Merge pull request #194 from lmars/netlink-set-mac-addr
netlink: Add NetworkSetMacAddress
2014-09-19 11:18:51 -07:00
Lewis Marshall 80a574ab49 netlink: Add NetworkSetMacAddress
Signed-off-by: Lewis Marshall <lewis@lmars.net>
2014-09-18 02:15:32 +01:00
Michael Crosby e1d882b523 Merge pull request #192 from titanous/netlink-cleanup
netlink: Add uint32Attr helper
2014-09-16 10:56:33 -07:00
Jonathan Rudenberg 9fb21a605a netlink: Add uint32Attr helper
Signed-off-by: Jonathan Rudenberg <jonathan@titanous.com>
2014-09-16 09:59:15 -04:00
Victor Marmol c1fa152a61 Merge pull request #190 from titanous/netlink-cleanup
Netlink cleanup
2014-09-15 15:36:05 -07:00
Jonathan Rudenberg f5b7ee170f netlink: Cleanup veth pair created during tests
Signed-off-by: Jonathan Rudenberg <jonathan@titanous.com>
2014-09-15 14:18:17 -04:00
Jonathan Rudenberg 65842f749b netlink: Extract message checks into reusable method
Signed-off-by: Jonathan Rudenberg <jonathan@titanous.com>
2014-09-15 14:18:17 -04:00
Jonathan Rudenberg 6e4334a68e netlink: Cache native endianness during init
Signed-off-by: Jonathan Rudenberg <jonathan@titanous.com>
2014-09-14 20:40:41 -04:00
Michael Crosby d83cb4e1f6 Merge pull request #185 from cf-guardian/typed_errors
Add rich errors to the API
2014-09-12 14:10:01 -07:00
Victor Marmol 7f9256cdc9 Merge pull request #189 from vmarmol/cache-mounts
Cache cgroup root mount location.
2014-09-10 17:54:06 -07:00
Victor Marmol 3cbe3eb3f6 Cache cgroup root mount location.
We calculate this on every cgroup call. It comprised of 30%+ of the CPU
usage in cAdvisor.

Docker-DCO-1.1-Signed-off-by: Victor Marmol <vmarmol@google.com> (github: vmarmol)
2014-09-10 17:44:13 -07:00
Victor Marmol 1fe601949e Merge pull request #186 from cf-guardian/devices_error_injection
Devices error injection
2014-09-09 10:58:09 -07:00
Michael Crosby 84ad9386a0 Merge pull request #184 from erikh/slave_mounts
Allow mounts to be supplied with the MS_SLAVE option.
2014-09-09 10:34:34 -07:00
Steve Powell 8453bee1ca Unify the errors ProcessConfigInvalid and ConfigInvalid to avoid caller confusion.
There is no check that these are being confused since they are both in the same type.

Signed-off-by: Steve Powell <spowell@pivotal.io>
2014-09-05 10:08:11 -07:00
Steve Powell 67e4c76c16 Inject errors into ioutil.ReadDir calls from devices.go
Added ioutilReadDir variable and test following the pattern
established by osLstat.

Signed-off-by: Steve Powell <spowell@pivotal.io>
2014-09-04 17:00:09 -07:00
Steve Powell 28e964bac6 Inject errors into os.Lstat call from devices.go
Since the caller of os.Lstat in devices.go is a function (not a method),
we use a variable to allow os.Lstat to be substituted during testing.

In this case the variable osLstat is private to the devices package to
prevent abuse. So the testcase needs to reside in the same package.

This commit includes a simple test of GetDevices() using osLstat to
simulate an error being returned from os.Lstat. In this case, the
behaviour of GetDevices() in the error case is trivial, but this may
change.

This is just the beginning of error injection. In future, it may be
necessary to pull out repetitive code sequences into a common file.

Signed-off-by: Steve Powell <spowell@pivotal.io>
2014-09-04 16:34:51 -07:00
Glyn Normington 582b25986d Add rich errors to the API
Add a rich Error type to the libcontainer package and use it in the API so
that callers can:

  * Check for a specific error without depending on an error string,
  * Obtain the stack trace of the function or method which detected the error.

The Error type provides a typed error code and a stack trace. The error code
identifies the error and enables the caller to test for it without being
sensitive to changes in the error text. The stack trace identifies the point
at which the error was detected. The combination of error code and stack trace
will enable errors to be diagnosed much more easily and with less guesswork
than when raw string-based errors are used.

The Error type conforms to the error interface and its Error method prints a
short error message. The Detail method provides a verbose error message
including the stack trace.

Notes:

1. There is an unfortunate precedent in the Go standard library which uses
variables to define errors. Checking for a specific error involves a string
comparison and assumes the corresponding variable has not been updated. It is
more robust and efficient to identify errors with integer-based types and
associated constants, although errors should still include a string
description for ease of use by humans.

2. It is not feasible to assign distinct types to Factory and Container
error codes because common errors such as SystemError cannot be declared in
two places and the names of the error codes then need to be decorated. This is
less readable.

Signed-off-by: Steve Powell <spowell@pivotal.io>
2014-09-04 15:01:09 -07:00
Michael Crosby 318d845931 Merge pull request #172 from cf-guardian/create-api
Correct Create() api call description in Factory interface.
2014-09-04 09:07:49 -07:00
Erik Hollensbe 73db17b4d7 Allow mounts to be supplied with the MS_SLAVE option.
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
2014-09-03 19:37:48 -07:00
Steve Powell 24e7b86a87 Remove erroneous reference to `path` in description and error list;
add format description for `id` string;
add "invalid format" error for `id` string;
remove initial capitals on references to parameter names;
remove reference to `initialConfig`;
add description of id checking.

Signed-off-by: Steve Powell <spowell@pivotal.io>
2014-09-03 17:30:13 -07:00
Victor Marmol 395d842ab4 Merge pull request #174 from vmarmol/no-sleep
Remove sampling from libcontainer CPU stats.
2014-09-03 16:09:59 -07:00
Victor Marmol 40d371a735 Merge pull request #173 from crosbymichael/device-ownership
Get UID and GID for device nodes
2014-09-02 10:16:17 -07:00
Victor Marmol d2a3ff2620 Merge pull request #170 from soundcloud/syncpipe-read-before-close-child
syncpipe: consume from parent before closing child
2014-09-02 10:05:20 -07:00
Michael Crosby 55f3560c3e Get UID and GID for device nodes
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2014-09-01 17:29:50 -07:00
Bernerd Schaefer 1faa2b56df syncpipe: read from parent before reporting error
Docker-DCO-1.1-Signed-off-by: Bernerd Schaefer <bj.schaefer@gmail.com> (github: bernerdschaefer)
2014-09-01 10:36:55 +02:00
Victor Marmol 2636848328 Remove sampling from libcontainer CPU stats.
Sampling should be done by higher layer in configurable intervals. This
change removes the percentage stat as sampling is required for this.

Docker-DCO-1.1-Signed-off-by: Victor Marmol <vmarmol@google.com> (github: vmarmol)
2014-08-30 09:58:27 -07:00
Michael Crosby 55430d0db7 Merge pull request #166 from crosbymichael/api-update
Update container to have an ID provided by the user
2014-08-29 11:55:12 -07:00
Michael Crosby d6348aec6c Update container to have ID provided by the user
Signed-off-by: Michael Crosby <michael@docker.com>
2014-08-29 11:49:01 -07:00
Michael Crosby 4080743cbc Merge pull request #167 from discordianfish/use-blkio-throttle-stats-as-backup
Use blkio.throttle.* stats when CFQ is not in use
2014-08-28 16:35:13 -07:00
Rohit Jnagal 9f289bafe3 Merge pull request #168 from crosbymichael/tmpfs
Add support for user defined mounts in tmpfs
2014-08-28 13:23:17 -07:00
Johannes 'fish' Ziemke 78700bfea3 Use blkio.throttle.* stats when CFQ is not in use
This makes blkio's GetStats try to read blkio.io_serviced_recursive
first and fall back to read the stats from blkio.throttle in case it
can't. blkio.io_serviced_recursive seems to be available across all
kernels with CFQ enabled.

This closes #165

Signed-off-by: Johannes 'fish' Ziemke <github@freigeist.org>
2014-08-27 15:01:46 +02:00
Michael Crosby 07212ae6ca Add tmpfs support to Mount
Signed-off-by: Michael Crosby <michael@docker.com>
2014-08-27 03:39:46 -07:00
Michael Crosby daa3a548b9 Move mount logic into Mount type
Signed-off-by: Michael Crosby <michael@docker.com>
2014-08-27 01:51:52 -07:00
Michael Crosby 1ecaf30408 Merge pull request #164 from crosbymichael/use-privilged
Use --privileged in Makefile
2014-08-25 11:16:09 -07:00
Michael Crosby 3e908c1f0c Merge pull request #162 from rhatdan/unreserve
Allow docker to free container labels when containers are removed.
2014-08-25 11:04:53 -07:00
Michael Crosby 29a79f7092 Use --privileged in Makefile
We need --privileged for apparmor based systems until we have an
apparmor specific flag to set the profile to unconfined.

Signed-off-by: Michael Crosby <michael@docker.com>
2014-08-25 11:03:59 -07:00
Dan Walsh f5d6269371 Allow docker to free container labels when containers are removed.
Currently we do not remove reservations on MCS labels when a container
is removed.  Not a big problem, since on reboot it would be freed.
But we should be cleaning this up.  Currently we support ~500,000
labels.

Docker-DCO-1.1-Signed-off-by: Dan Walsh <dwalsh@redhat.com> (github: rhatdan)
2014-08-20 17:07:38 -04:00
Michael Crosby db65c35051 Merge pull request #161 from crosbymichael/return-notfound-err
Return NotFound error for cgroups abs paths
2014-08-20 14:39:56 -05:00
Michael Crosby a117d3a1c0 Ignore not found erros in Paths
Signed-off-by: Michael Crosby <michael@docker.com>
2014-08-20 10:39:48 -07:00
Michael Crosby 3cdf12b041 Change not found error to be typed with cgroup subsystem
Signed-off-by: Michael Crosby <michael@docker.com>
2014-08-20 10:32:01 -07:00
Michael Crosby 4aa9963faf Return NotFound error for cgroups abs paths
Signed-off-by: Michael Crosby <michael@docker.com>
2014-08-20 10:14:56 -07:00
Michael Crosby edfe81a08b Merge pull request #159 from LK4D4/remove_docker_systemd_dep
Remove dependency from docker/pkg/systemd
2014-08-19 12:55:19 -05:00
Alexandr Morozov 388d143d19
Remove dependency from docker/pkg/systemd
Signed-off-by: Alexandr Morozov <lk4d4math@gmail.com>
2014-08-19 20:16:39 +04:00
Victor Marmol 29363e2d2d Merge pull request #143 from vishh/enter_cgroup
Enter cgroups as part of NsEnter
2014-08-14 14:04:19 -04:00
Vish Kannan 86ba98bbfd Merge pull request #4 from crosbymichael/cgroup-enter
Cleanup systemd cgroup code
2014-08-13 23:26:18 -07:00
Michael Crosby 781855b62a Cleanup systemd cgroup code
The current paths for the different systemd cgroup subsystems that
systemd manages and that we have to manage are very inconsistent.  This
patch cleans up those differences and allows consistent paths to be
used.

Signed-off-by: Michael Crosby <michael@docker.com>
2014-08-13 18:16:51 -07:00
Vishnu Kannan 97de9a45f9 Update cgroups paths in state to be a map with cgroup type as key and path as value.
Docker-DCO-1.1-Signed-off-by: Vishnu Kannan <vishnuk@google.com> (github: vishh)
2014-08-13 23:26:27 +00:00
Vishnu Kannan ad16526d7f Store all the cgroups paths as part of the state. This simplifies entering cgroups and will be useful for
cleanups too in the future.
Docker-DCO-1.1-Signed-off-by: Vishnu Kannan <vishnuk@google.com> (github: vishh)
2014-08-13 23:26:27 +00:00