mirror of https://github.com/docker/docs.git
Merge pull request #9809 from LK4D4/fix_host_networking
Update libcontainer to 0f397d4e145fb4053792d42b3424dd2143fb23ad
This commit is contained in:
commit
43886decfe
|
@ -2705,3 +2705,21 @@ func TestRunNonLocalMacAddress(t *testing.T) {
|
||||||
|
|
||||||
logDone("run - use non-local mac-address")
|
logDone("run - use non-local mac-address")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestRunNetHost(t *testing.T) {
|
||||||
|
defer deleteAllContainers()
|
||||||
|
iplinkHost, err := exec.Command("ip", "link", "list").CombinedOutput()
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
iplinkCont, err := exec.Command(dockerBinary, "run", "--net=host", "busybox", "ip", "link", "list").CombinedOutput()
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !bytes.Equal(iplinkHost, iplinkCont) {
|
||||||
|
t.Fatalf("Container network:\n%s\nis not equal to host network:\n%s", iplinkCont, iplinkHost)
|
||||||
|
}
|
||||||
|
logDone("run - host network")
|
||||||
|
}
|
||||||
|
|
|
@ -66,7 +66,7 @@ if [ "$1" = '--go' ]; then
|
||||||
mv tmp-tar src/code.google.com/p/go/src/pkg/archive/tar
|
mv tmp-tar src/code.google.com/p/go/src/pkg/archive/tar
|
||||||
fi
|
fi
|
||||||
|
|
||||||
clone git github.com/docker/libcontainer 1597c68f7b941fd97881155d7f077852e2914e7b
|
clone git github.com/docker/libcontainer 0f397d4e145fb4053792d42b3424dd2143fb23ad
|
||||||
# see src/github.com/docker/libcontainer/update-vendor.sh which is the "source of truth" for libcontainer deps (just like this file)
|
# see src/github.com/docker/libcontainer/update-vendor.sh which is the "source of truth" for libcontainer deps (just like this file)
|
||||||
rm -rf src/github.com/docker/libcontainer/vendor
|
rm -rf src/github.com/docker/libcontainer/vendor
|
||||||
eval "$(grep '^clone ' src/github.com/docker/libcontainer/update-vendor.sh | grep -v 'github.com/codegangsta/cli')"
|
eval "$(grep '^clone ' src/github.com/docker/libcontainer/update-vendor.sh | grep -v 'github.com/codegangsta/cli')"
|
||||||
|
|
|
@ -2,4 +2,5 @@ Michael Crosby <michael@docker.com> (@crosbymichael)
|
||||||
Rohit Jnagal <jnagal@google.com> (@rjnagal)
|
Rohit Jnagal <jnagal@google.com> (@rjnagal)
|
||||||
Victor Marmol <vmarmol@google.com> (@vmarmol)
|
Victor Marmol <vmarmol@google.com> (@vmarmol)
|
||||||
Mrunal Patel <mpatel@redhat.com> (@mrunalp)
|
Mrunal Patel <mpatel@redhat.com> (@mrunalp)
|
||||||
|
Alexandr Morozov <lk4d4@docker.com> (@LK4D4)
|
||||||
update-vendor.sh: Tianon Gravi <admwiggin@gmail.com> (@tianon)
|
update-vendor.sh: Tianon Gravi <admwiggin@gmail.com> (@tianon)
|
||||||
|
|
|
@ -30,26 +30,26 @@ type Namespace struct {
|
||||||
|
|
||||||
type Namespaces []Namespace
|
type Namespaces []Namespace
|
||||||
|
|
||||||
func (n Namespaces) Remove(t NamespaceType) bool {
|
func (n *Namespaces) Remove(t NamespaceType) bool {
|
||||||
i := n.index(t)
|
i := n.index(t)
|
||||||
if i == -1 {
|
if i == -1 {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
n = append(n[:i], n[i+1:]...)
|
*n = append((*n)[:i], (*n)[i+1:]...)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n Namespaces) Add(t NamespaceType, path string) {
|
func (n *Namespaces) Add(t NamespaceType, path string) {
|
||||||
i := n.index(t)
|
i := n.index(t)
|
||||||
if i == -1 {
|
if i == -1 {
|
||||||
n = append(n, Namespace{Type: t, Path: path})
|
*n = append(*n, Namespace{Type: t, Path: path})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
n[i].Path = path
|
(*n)[i].Path = path
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n Namespaces) index(t NamespaceType) int {
|
func (n *Namespaces) index(t NamespaceType) int {
|
||||||
for i, ns := range n {
|
for i, ns := range *n {
|
||||||
if ns.Type == t {
|
if ns.Type == t {
|
||||||
return i
|
return i
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ func (n Namespaces) index(t NamespaceType) int {
|
||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n Namespaces) Contains(t NamespaceType) bool {
|
func (n *Namespaces) Contains(t NamespaceType) bool {
|
||||||
return n.index(t) != -1
|
return n.index(t) != -1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -158,3 +158,15 @@ func TestSelinuxLabels(t *testing.T) {
|
||||||
t.Fatalf("expected mount label %q but received %q", label, container.MountConfig.MountLabel)
|
t.Fatalf("expected mount label %q but received %q", label, container.MountConfig.MountLabel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestRemoveNamespace(t *testing.T) {
|
||||||
|
ns := Namespaces{
|
||||||
|
{Type: NEWNET},
|
||||||
|
}
|
||||||
|
if !ns.Remove(NEWNET) {
|
||||||
|
t.Fatal("NEWNET was not removed")
|
||||||
|
}
|
||||||
|
if len(ns) != 0 {
|
||||||
|
t.Fatalf("namespaces should have 0 items but reports %d", len(ns))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue