浏览代码

Merge pull request #10055 from icecrime/upgrade_libcontainer

Upgrade libcontainer to 1d3b2589d734dc94a1719a3af4
Michael Crosby 10 年之前
父节点
当前提交
9f2c486144

+ 1 - 1
project/vendor.sh

@@ -68,7 +68,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 6460fd79667466d2d9ec03f77f319a241c58d40b
+clone git github.com/docker/libcontainer 1d3b2589d734dc94a1719a3af40b87ed8319f329
 # 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')"

+ 5 - 1
vendor/src/github.com/docker/libcontainer/ROADMAP.md

@@ -13,4 +13,8 @@ Our goal is to make libcontainer run everywhere, but currently libcontainer requ
 
 
 ## Cross-architecture support
 ## Cross-architecture support
 
 
-Our goal is to make libcontainer run everywhere. However currently libcontainer only runs on x86_64 systems. We plan on expanding architecture support, so that libcontainer containers can be created and used on more architectures.
+Our goal is to make libcontainer run everywhere. Recently libcontainer has
+expanded from its initial support for x86_64 systems to include POWER (ppc64
+little and big endian variants), IBM System z (s390x 64-bit), and ARM. We plan
+to continue expanding architecture support such that libcontainer containers
+can be created and used on more architectures.

+ 10 - 1
vendor/src/github.com/docker/libcontainer/namespaces/exec.go

@@ -17,6 +17,10 @@ import (
 	"github.com/docker/libcontainer/system"
 	"github.com/docker/libcontainer/system"
 )
 )
 
 
+const (
+	EXIT_SIGNAL_OFFSET = 128
+)
+
 // TODO(vishh): This is part of the libcontainer API and it does much more than just namespaces related work.
 // TODO(vishh): This is part of the libcontainer API and it does much more than just namespaces related work.
 // Move this to libcontainer package.
 // Move this to libcontainer package.
 // Exec performs setup outside of a namespace so that a container can be
 // Exec performs setup outside of a namespace so that a container can be
@@ -113,7 +117,12 @@ func Exec(container *libcontainer.Config, stdin io.Reader, stdout, stderr io.Wri
 	if !container.Namespaces.Contains(libcontainer.NEWPID) {
 	if !container.Namespaces.Contains(libcontainer.NEWPID) {
 		killAllPids(container)
 		killAllPids(container)
 	}
 	}
-	return command.ProcessState.Sys().(syscall.WaitStatus).ExitStatus(), nil
+
+	waitStatus := command.ProcessState.Sys().(syscall.WaitStatus)
+	if waitStatus.Signaled() {
+		return EXIT_SIGNAL_OFFSET + int(waitStatus.Signal()), nil
+	}
+	return waitStatus.ExitStatus(), nil
 }
 }
 
 
 // killAllPids itterates over all of the container's processes
 // killAllPids itterates over all of the container's processes

+ 3 - 2
vendor/src/github.com/docker/libcontainer/nsinit/main.go

@@ -53,11 +53,12 @@ func main() {
 	app.Before = preload
 	app.Before = preload
 
 
 	app.Commands = []cli.Command{
 	app.Commands = []cli.Command{
+		configCommand,
 		execCommand,
 		execCommand,
 		initCommand,
 		initCommand,
-		statsCommand,
-		configCommand,
+		oomCommand,
 		pauseCommand,
 		pauseCommand,
+		statsCommand,
 		unpauseCommand,
 		unpauseCommand,
 	}
 	}
 
 

+ 28 - 0
vendor/src/github.com/docker/libcontainer/nsinit/oom.go

@@ -0,0 +1,28 @@
+package main
+
+import (
+	"log"
+
+	"github.com/codegangsta/cli"
+	"github.com/docker/libcontainer"
+)
+
+var oomCommand = cli.Command{
+	Name:   "oom",
+	Usage:  "display oom notifications for a container",
+	Action: oomAction,
+}
+
+func oomAction(context *cli.Context) {
+	state, err := libcontainer.GetState(dataPath)
+	if err != nil {
+		log.Fatal(err)
+	}
+	n, err := libcontainer.NotifyOnOOM(state)
+	if err != nil {
+		log.Fatal(err)
+	}
+	for _ = range n {
+		log.Printf("OOM notification received")
+	}
+}