Commit Graph

654 Commits

Author SHA1 Message Date
Victor Marmol f4254672e6 Merge pull request #216 from cbosdo/master
cgroups: Export ParseCgroupFile
2014-10-08 10:51:49 +02:00
Alexander Larsson 06949e779f pkg/cgroups: Export ParseCgroupFile
This is needed for the libvirt exec driver.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Docker-DCO-1.1-Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com> (github: jpoimboe)
2014-10-07 15:55:58 +02:00
Michael Crosby 2dce757d21 Merge pull request #213 from tianon/crosbymichael_test.go
Fix "go install -v . ./.git/logs/refs/heads ./.git/refs/heads ..."
2014-10-03 11:06:24 -07:00
Tianon Gravi 49da8a49fa Fix "go install -v . ./.git/logs/refs/heads ./.git/refs/heads ..."
This happens when you name a git object (branch, tag, etc) `something_test.go`.

Signed-off-by: Andrew Page <admwiggin@gmail.com>
2014-10-02 16:19:56 -06:00
Victor Marmol b3570267c7 Merge pull request #212 from crosbymichael/veth-naming
Add more entropy to veth pair creation
2014-10-02 15:11:47 -07:00
Michael Crosby b9d08491f6 Add loop for veth pair creation on ErrInterfaceExists
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2014-10-02 22:03:25 +00:00
Michael Crosby 255989b835 Introduce more entropy in veth name generation
The current 4 chars are not enough, bumped to 7

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2014-10-02 21:56:48 +00:00
Mrunal Patel 12845ae8aa Merge pull request #202 from harshavardhana/xattr_list_xattr
Update system/xattrs_linux.go
2014-10-01 17:28:05 -07:00
Harshavardhana 5dca16dcb8 xattr/xattr.go: Add new higher level helpers for xattr
Signed-off-by: Harshavardhana <fharshav@redhat.com>
2014-10-01 17:24:03 -07:00
Harshavardhana 6224908d4e Update system/xattrs_linux.go
- Add Llistxattr() support
- Additionally cleanup Lgetxattr() and implement it properly
  in accordance with getxattr() syscall behavior.

Signed-off-by: Harshavardhana <fharshav@redhat.com>
2014-10-01 17:24:03 -07:00
Victor Marmol 0a5fde25c5 Merge pull request #208 from MalteJ/master
Expose parameter to set interface MAC address
2014-09-30 08:27:47 -07:00
Malte Janduda d804790e8d MACAddress -> MacAddress
Docker-DCO-1.1-Signed-off-by: Malte Janduda <mail@janduda.net> (github: MalteJ)
2014-09-30 00:33:12 +02:00
Malte Janduda bf54bdfd7f implementing SetInterfaceMac
Docker-DCO-1.1-Signed-off-by: Malte Janduda <mail@janduda.net> (github: MalteJ)
2014-09-29 23:55:47 +02:00
Mrunal Patel c744f6470e Merge pull request #206 from milosgajdos83/vlan-macvlan
Added support for VLAN and MAC VLAN interfaces plus did a bit of refactoring.
2014-09-29 13:22:49 -07:00
Milos Gajdos d90daa0cf7 Added VLAN and MAC VLAN device support to netlink
You can now create VLAN and MAC VLAN devices using netlink.
I've also added tests for both VLAN and MAC VLAN stuff.

Signed-off-by: Milos Gajdos <milosgajdos83@gmail.com> (github: milosgajdos83)
2014-09-27 04:15:34 +01:00
Milos Gajdos 267ba8f753 Refactored SetNs funcs. Implemented ChangeName.
I've refactored NetworkSetNsPid and NetworkSetNsFd following
what we already have in place for Add/Del Ip and Add/Del Link.
I've reimplemented NetworkChangeName function which is now
using netlink for changing the interface name. I added tests too.
I've moved the original syscall implementation at the bottom
to keep it together with the other non-netlink functions.

Signed-off-by: Milos Gajdos <milosgajdos83@gmail.com> (github: milosgajdos83)
2014-09-27 02:27:32 +01:00
Victor Marmol 30e50af760 Merge pull request #205 from hugoduncan/fix-leaking-fd-in-netns
Fix leaking file descriptor in NetNs strategy
2014-09-25 13:23:10 -07:00
Hugo Duncan 52f4743aba Fix leaking file descriptor in NetNs strategy
Docker-DCO-1.1-Signed-off-by: Hugo Duncan <hugo@hugoduncan.org> (github: hugoduncan)
2014-09-25 14:05:24 -04:00
Victor Marmol 605edd6394 Merge pull request #203 from MalteJ/master
Adding IPv6 network support
2014-09-25 08:29:06 -07:00
Malte Janduda 4a14248dc8 Address6 -> IPv6Address and Gateway6 -> IPv6Gateway
Docker-DCO-1.1-Signed-off-by: Malte Janduda <mail@janduda.net> (github: MalteJ)
2014-09-24 20:48:00 +02:00
Mrunal Patel 0da391f51c Merge pull request #201 from vishh/stats_rounding
Saturate negative memory stat values at '0'.
2014-09-24 10:35:53 -07:00
Vishnu Kannan 4bfda8a764 Saturate negative memory stat values at '0'.
Docker-DCO-1.1-Signed-off-by: Vishnu Kannan <vishnuk@google.com> (github: vishh)
2014-09-24 16:47:41 +00:00
Malte Janduda dd9e42732e Adding IPv6 network support
Docker-DCO-1.1-Signed-off-by: Malte Janduda <mail@janduda.net> (github: MalteJ)
2014-09-24 11:36:40 +02:00
Michael Crosby 40f1336057 Merge pull request #199 from SaiedKazemi/rootfs
Add RootFs field to configuration options in libcontainer's Config
2014-09-23 16:49:04 -07:00
Saied Kazemi bbd2b4cbff Merge branch 'rootfs' of https://github.com/SaiedKazemi/libcontainer into rootfs
Conflicts:
	namespaces/exec.go
2014-09-23 16:18:48 -07:00
Saied Kazemi ae81ea069f Add RootFs field to configuration options in libcontainer's Config
Since currently the container.json file does not include the pathname
to a container's root filesystem, we need to parse /proc/mounts which
is slow and error-prone.  This patch addresses this issue by adding a
new RootFs field.

Signed-off-by: Saied Kazemi <saied@google.com>
2014-09-23 16:16:13 -07:00
Saied Kazemi e4a4af4bfe Add RootFs field to configuration options in libcontainer's Config
Since currently the container.json file does not include the pathname
to a container's root filesystem, we need to parse /proc/mounts which
is slow and error-prone.  This patch addresses this issue by adding a
new RootFs field.

Signed-off-by: Saied Kazemi <saied@google.com>
2014-09-23 14:04:55 -07:00
Victor Marmol 930cdd82c9 Merge pull request #197 from milosgajdos83/netlink-tests
Refactored and added more tests.Cleaned up netlink a bit.
2014-09-22 15:52:21 -07:00
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