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)
This commit is contained in:
Timothy Hobbs 2014-02-17 15:14:30 -08:00 committed by Timothy
parent c8a8176936
commit 193f9894c0
11 changed files with 377 additions and 144 deletions

View file

@ -4,8 +4,6 @@ import (
"encoding/json"
"os"
"testing"
"github.com/dotcloud/docker/pkg/libcontainer/mount/nodes"
)
// Checks whether the expected capability is specified in the capabilities.
@ -63,11 +61,4 @@ func TestContainerJsonFormat(t *testing.T) {
t.Log("capabilities mask should not contain SYS_CHROOT")
t.Fail()
}
for _, n := range nodes.DefaultNodes {
if !contains(n, container.RequiredDeviceNodes) {
t.Logf("devices should contain %s", n)
t.Fail()
}
}
}