diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index 82718a56..3b5137c5 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -21,16 +21,6 @@ "Comment": "v1.18.1", "Rev": "a14d7d367bc02b1f57d88de97926727f2d936387" }, - { - "ImportPath": "github.com/docker/containerd/api/grpc/types", - "Comment": "v0.2.3-10-g4f0a33a", - "Rev": "4f0a33ac3d5de20505022455625020cbbd575071" - }, - { - "ImportPath": "github.com/docker/containerd/osutils", - "Comment": "v0.2.3-10-g4f0a33a", - "Rev": "4f0a33ac3d5de20505022455625020cbbd575071" - }, { "ImportPath": "github.com/docker/docker/daemon/logger", "Comment": "v1.12.1", diff --git a/exec.go b/exec.go index 29b7aed0..febfeef2 100644 --- a/exec.go +++ b/exec.go @@ -9,8 +9,8 @@ import ( "strings" "github.com/codegangsta/cli" - "github.com/docker/containerd/api/grpc/types" "github.com/hyperhq/runv/lib/term" + "github.com/hyperhq/runv/supervisord/api/grpc/types" "github.com/opencontainers/runtime-spec/specs-go" netcontext "golang.org/x/net/context" ) diff --git a/integration-test/init_test.go b/integration-test/init_test.go index 2391b1ed..94ca7631 100644 --- a/integration-test/init_test.go +++ b/integration-test/init_test.go @@ -117,5 +117,5 @@ func (s *RunVSuite) TearDownTest(c *check.C) { // after kill/delete functions are stable exec.Command("pkill", "-9", "runv-namespaced").Run() exec.Command("pkill", "-9", "qemu").Run() - exec.Command("pkill", "-9", "containerd-nslistener") + exec.Command("pkill", "-9", "supervisord-nslistener") } diff --git a/kill.go b/kill.go index cf2a50c0..79d4b559 100644 --- a/kill.go +++ b/kill.go @@ -9,8 +9,8 @@ import ( "syscall" "github.com/codegangsta/cli" - "github.com/docker/containerd/api/grpc/types" "github.com/hyperhq/runv/lib/linuxsignal" + "github.com/hyperhq/runv/supervisord/api/grpc/types" netcontext "golang.org/x/net/context" ) diff --git a/main.go b/main.go index 88b56c9c..1ee41149 100644 --- a/main.go +++ b/main.go @@ -9,11 +9,11 @@ import ( "time" "github.com/codegangsta/cli" - "github.com/docker/containerd/api/grpc/types" "github.com/docker/docker/pkg/reexec" "github.com/golang/protobuf/ptypes" - "github.com/hyperhq/runv/containerd" _ "github.com/hyperhq/runv/supervisor/proxy" // for proxy.init() + "github.com/hyperhq/runv/supervisord" + "github.com/hyperhq/runv/supervisord/api/grpc/types" netcontext "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/grpclog" @@ -121,7 +121,7 @@ func main() { listCommand, stateCommand, manageCommand, - containerd.ContainerdCommand, + supervisord.SupervisordCommand, } if err := app.Run(os.Args); err != nil { fmt.Printf("%s\n", err.Error()) diff --git a/start.go b/start.go index 4c8846cf..49541081 100644 --- a/start.go +++ b/start.go @@ -11,8 +11,8 @@ import ( "syscall" "github.com/codegangsta/cli" - "github.com/docker/containerd/api/grpc/types" "github.com/hyperhq/runv/lib/term" + "github.com/hyperhq/runv/supervisord/api/grpc/types" "github.com/kardianos/osext" "github.com/opencontainers/runtime-spec/specs-go" netcontext "golang.org/x/net/context" @@ -197,8 +197,8 @@ command(s) that get executed on start, edit the args parameter of the spec. See } } args = append(args, - "containerd", "--solo-namespaced", - "--containerd-dir", namespace, + "supervisord", "--solo-namespaced", + "--supervisord-dir", namespace, "--state-dir", root, "--listen", filepath.Join(namespace, "namespaced.sock"), ) @@ -210,7 +210,7 @@ command(s) that get executed on start, edit the args parameter of the spec. See } err = cmd.Start() if err != nil { - fmt.Printf("failed to launch runv containerd, error:%v\n", err) + fmt.Printf("failed to launch runv supervisord, error:%v\n", err) os.Exit(-1) } address = filepath.Join(namespace, "namespaced.sock") diff --git a/supervisor/events.go b/supervisor/events.go index 9f505510..a211d5dd 100644 --- a/supervisor/events.go +++ b/supervisor/events.go @@ -54,7 +54,7 @@ func (se *SvEvents) setupEventLog(logDir string) error { glog.Infof("write event log: %v", e) se.eventLog = append(se.eventLog, e) if err := enc.Encode(e); err != nil { - glog.Infof("containerd: fail to write event to journal") + glog.Infof("supervisord: fail to write event to journal") } } }() diff --git a/supervisor/hyperpod.go b/supervisor/hyperpod.go index f9d469dc..1f7239bc 100644 --- a/supervisor/hyperpod.go +++ b/supervisor/hyperpod.go @@ -308,7 +308,7 @@ func (hp *HyperPod) startNsListener() (err error) { glog.Infof("get exec path %s", path) parentPipe, childPipe, err = newPipe() if err != nil { - glog.Errorf("create pipe for containerd-nslistener failed: %v", err) + glog.Errorf("create pipe for supervisord-nslistener failed: %v", err) return err } @@ -320,10 +320,10 @@ func (hp *HyperPod) startNsListener() (err error) { }() cmd := exec.Command(path) - cmd.Args[0] = "containerd-nslistener" + cmd.Args[0] = "supervisord-nslistener" cmd.ExtraFiles = append(cmd.ExtraFiles, childPipe) if err = cmd.Start(); err != nil { - glog.Errorf("start containerd-nslistener failed: %v", err) + glog.Errorf("start supervisord-nslistener failed: %v", err) return err } @@ -347,12 +347,12 @@ func (hp *HyperPod) startNsListener() (err error) { /* Make sure nsListener create new netns */ var ready string if err = dec.Decode(&ready); err != nil { - glog.Errorf("Get ready message from containerd-nslistener failed: %v", err) + glog.Errorf("Get ready message from supervisord-nslistener failed: %v", err) return err } if ready != "init" { - err = fmt.Errorf("containerd get incorrect init message: %s", ready) + err = fmt.Errorf("supervisord get incorrect init message: %s", ready) return err } diff --git a/supervisor/proxy/nslistener.go b/supervisor/proxy/nslistener.go index b79cac13..be89aa6a 100644 --- a/supervisor/proxy/nslistener.go +++ b/supervisor/proxy/nslistener.go @@ -14,7 +14,7 @@ import ( ) func init() { - reexec.Register("containerd-nslistener", setupNsListener) + reexec.Register("supervisord-nslistener", setupNsListener) } func setupNsListener() { @@ -31,7 +31,7 @@ func setupNsListener() { enc := gob.NewEncoder(childPipe) dec := gob.NewDecoder(childPipe) - /* notify containerd to execute prestart hooks */ + /* notify supervisord to execute prestart hooks */ if err := enc.Encode("init"); err != nil { glog.Error(err) return @@ -49,7 +49,7 @@ func setupNsListener() { return } - // Get network namespace info for the first time and send to the containerd + // Get network namespace info for the first time and send to the supervisord /* get route info before link down */ routes, err := netlink.RouteList(nil, netlink.FAMILY_V4) if err != nil { @@ -57,7 +57,7 @@ func setupNsListener() { return } - /* send interface info to containerd */ + /* send interface info to supervisord */ infos := collectionInterfaceInfo() if err := enc.Encode(infos); err != nil { glog.Error(err) @@ -70,14 +70,14 @@ func setupNsListener() { } // This is a call back function. - // Use to send netlink update informations to containerd. - netNs2Containerd := func(netlinkUpdate supervisor.NetlinkUpdate) { + // Use to send netlink update informations to supervisord. + netNs2Supervisord := func(netlinkUpdate supervisor.NetlinkUpdate) { if err := enc.Encode(netlinkUpdate); err != nil { glog.Info("err Encode(netlinkUpdate) is :", err) } } - // Keep collecting network namespace info and sending to the containerd - setupNetworkNsTrap(netNs2Containerd) + // Keep collecting network namespace info and sending to the supervisord + setupNetworkNsTrap(netNs2Supervisord) } func collectionInterfaceInfo() []supervisor.InterfaceInfo { @@ -119,7 +119,7 @@ func collectionInterfaceInfo() []supervisor.InterfaceInfo { // This function should be put into the main process or somewhere that can be // use to init the network namespace trap. -func setupNetworkNsTrap(netNs2Containerd func(supervisor.NetlinkUpdate)) { +func setupNetworkNsTrap(netNs2Supervisord func(supervisor.NetlinkUpdate)) { // Subscribe for links change event chLink := make(chan netlink.LinkUpdate) @@ -148,11 +148,11 @@ func setupNetworkNsTrap(netNs2Containerd func(supervisor.NetlinkUpdate)) { for { select { case updateLink := <-chLink: - handleLink(updateLink, netNs2Containerd) + handleLink(updateLink, netNs2Supervisord) case updateAddr := <-chAddr: - handleAddr(updateAddr, netNs2Containerd) + handleAddr(updateAddr, netNs2Supervisord) case updateRoute := <-chRoute: - handleRoute(updateRoute, netNs2Containerd) + handleRoute(updateRoute, netNs2Supervisord) } } } diff --git a/vendor/github.com/docker/containerd/LICENSE.code b/supervisord/LICENSE.code similarity index 100% rename from vendor/github.com/docker/containerd/LICENSE.code rename to supervisord/LICENSE.code diff --git a/vendor/github.com/docker/containerd/LICENSE.docs b/supervisord/LICENSE.docs similarity index 100% rename from vendor/github.com/docker/containerd/LICENSE.docs rename to supervisord/LICENSE.docs diff --git a/vendor/github.com/docker/containerd/NOTICE b/supervisord/NOTICE similarity index 100% rename from vendor/github.com/docker/containerd/NOTICE rename to supervisord/NOTICE diff --git a/containerd/README.md b/supervisord/README.md similarity index 79% rename from containerd/README.md rename to supervisord/README.md index ffac492e..43b81e5d 100644 --- a/containerd/README.md +++ b/supervisord/README.md @@ -1,6 +1,6 @@ -# containerd +# supervisord -runv-containerd is a daemon to control hypercontainer and supports the same gRPC api of the [docker-containerd](https://github.com/docker/containerd/). +runv-supervisord is a daemon to control hypercontainer and supports the same gRPC api of the [docker-containerd](https://github.com/docker/containerd/). ## Getting started @@ -14,9 +14,9 @@ runv-containerd is a daemon to control hypercontainer and supports the same gRPC ```bash # in terminal #1 -runv --debug --driver libvirt --kernel /opt/hyperstart/build/kernel --initrd /opt/hyperstart/build/hyper-initrd.img containerd +runv --debug --driver libvirt --kernel /opt/hyperstart/build/kernel --initrd /opt/hyperstart/build/hyper-initrd.img supervisord # in terminal #2 -docker daemon -D -l debug --containerd=/run/runv-containerd/containerd.sock +docker daemon -D -l debug --containerd=/run/runv-supervisord/supervisord.sock # in terminal #3 for trying it docker run -ti busybox # ls # (already in the terminal of the busybox container) diff --git a/containerd/api/grpc/server/server.go b/supervisord/api/grpc/server/server.go similarity index 98% rename from containerd/api/grpc/server/server.go rename to supervisord/api/grpc/server/server.go index ac24bdc4..44e4f77a 100644 --- a/containerd/api/grpc/server/server.go +++ b/supervisord/api/grpc/server/server.go @@ -9,10 +9,10 @@ import ( "time" "github.com/cloudfoundry/gosigar" - "github.com/docker/containerd/api/grpc/types" "github.com/golang/glog" "github.com/golang/protobuf/ptypes" "github.com/hyperhq/runv/supervisor" + "github.com/hyperhq/runv/supervisord/api/grpc/types" "github.com/opencontainers/runtime-spec/specs-go" "golang.org/x/net/context" ) @@ -33,7 +33,7 @@ func (s *apiServer) GetServerVersion(ctx context.Context, c *types.GetServerVers Major: 0, Minor: 6, Patch: 2, - Revision: "runv-containerd", + Revision: "runv-supervisord", }, nil } diff --git a/vendor/github.com/docker/containerd/api/grpc/types/api.pb.go b/supervisord/api/grpc/types/api.pb.go similarity index 100% rename from vendor/github.com/docker/containerd/api/grpc/types/api.pb.go rename to supervisord/api/grpc/types/api.pb.go diff --git a/vendor/github.com/docker/containerd/api/grpc/types/api.proto b/supervisord/api/grpc/types/api.proto similarity index 100% rename from vendor/github.com/docker/containerd/api/grpc/types/api.proto rename to supervisord/api/grpc/types/api.proto diff --git a/vendor/github.com/docker/containerd/osutils/fds.go b/supervisord/osutils/fds.go similarity index 100% rename from vendor/github.com/docker/containerd/osutils/fds.go rename to supervisord/osutils/fds.go diff --git a/vendor/github.com/docker/containerd/osutils/prctl.go b/supervisord/osutils/prctl.go similarity index 100% rename from vendor/github.com/docker/containerd/osutils/prctl.go rename to supervisord/osutils/prctl.go diff --git a/vendor/github.com/docker/containerd/osutils/prctl_solaris.go b/supervisord/osutils/prctl_solaris.go similarity index 100% rename from vendor/github.com/docker/containerd/osutils/prctl_solaris.go rename to supervisord/osutils/prctl_solaris.go diff --git a/vendor/github.com/docker/containerd/osutils/reaper.go b/supervisord/osutils/reaper.go similarity index 100% rename from vendor/github.com/docker/containerd/osutils/reaper.go rename to supervisord/osutils/reaper.go diff --git a/containerd/containerd.go b/supervisord/supervisord.go similarity index 83% rename from containerd/containerd.go rename to supervisord/supervisord.go index 8507fd05..a8f76c97 100644 --- a/containerd/containerd.go +++ b/supervisord/supervisord.go @@ -1,4 +1,4 @@ -package containerd +package supervisord import ( "encoding/json" @@ -11,29 +11,29 @@ import ( "time" "github.com/codegangsta/cli" - "github.com/docker/containerd/api/grpc/types" - "github.com/docker/containerd/osutils" "github.com/golang/glog" - "github.com/hyperhq/runv/containerd/api/grpc/server" "github.com/hyperhq/runv/driverloader" "github.com/hyperhq/runv/factory" singlefactory "github.com/hyperhq/runv/factory/single" templatefactory "github.com/hyperhq/runv/factory/template" "github.com/hyperhq/runv/hypervisor" "github.com/hyperhq/runv/supervisor" + "github.com/hyperhq/runv/supervisord/api/grpc/server" + "github.com/hyperhq/runv/supervisord/api/grpc/types" + "github.com/hyperhq/runv/supervisord/osutils" templatecore "github.com/hyperhq/runv/template" "google.golang.org/grpc" ) const ( usage = `High performance hypervisor based container daemon` - defaultStateDir = "/run/runv-containerd" + defaultStateDir = "/run/runv-supervisord" defaultListenType = "unix" - defaultGRPCEndpoint = "/run/runv-containerd/containerd.sock" + defaultGRPCEndpoint = "/run/runv-supervisord/supervisord.sock" ) -var ContainerdCommand = cli.Command{ - Name: "containerd", +var SupervisordCommand = cli.Command{ + Name: "supervisord", Usage: usage, Flags: []cli.Flag{ cli.StringFlag{ @@ -42,9 +42,9 @@ var ContainerdCommand = cli.Command{ Usage: "runtime state directory", }, cli.StringFlag{ - Name: "containerd-dir", + Name: "supervisord-dir", Value: defaultStateDir, - Usage: "containerd daemon state directory", + Usage: "supervisord daemon state directory", }, cli.StringFlag{ Name: "listen,l", @@ -62,9 +62,9 @@ var ContainerdCommand = cli.Command{ initrd := context.GlobalString("initrd") template := context.GlobalString("template") stateDir := context.String("state-dir") - containerdDir := context.String("containerd-dir") - if containerdDir == "" { - containerdDir = stateDir + supervisordDir := context.String("supervisord-dir") + if supervisordDir == "" { + supervisordDir = stateDir } if context.GlobalBool("debug") { @@ -114,7 +114,7 @@ var ContainerdCommand = cli.Command{ } else { f = factory.NewFromConfigs(kernel, initrd, nil) } - sv, err := supervisor.New(stateDir, containerdDir, f, + sv, err := supervisor.New(stateDir, supervisordDir, f, context.GlobalInt("default_cpus"), context.GlobalInt("default_memory")) if err != nil { glog.Infof("%v", err) @@ -122,7 +122,7 @@ var ContainerdCommand = cli.Command{ } if context.Bool("solo-namespaced") { - go namespaceShare(sv, containerdDir, stateDir) + go namespaceShare(sv, supervisordDir, stateDir) } if err = daemon(sv, context.String("listen")); err != nil { @@ -131,7 +131,7 @@ var ContainerdCommand = cli.Command{ } if context.Bool("solo-namespaced") { - os.RemoveAll(containerdDir) + os.RemoveAll(supervisordDir) } }, } @@ -150,10 +150,10 @@ func daemon(sv *supervisor.Supervisor, address string) error { switch ss { case syscall.SIGCHLD: if _, err := osutils.Reap(); err != nil { - glog.Infof("containerd: reap child processes") + glog.Infof("supervisord: reap child processes") } default: - glog.Infof("stopping containerd after receiving %s", ss) + glog.Infof("stopping supervisord after receiving %s", ss) time.Sleep(3 * time.Second) // TODO: fix it by proper way server.Stop() return nil @@ -189,9 +189,9 @@ func startServer(address string, sv *supervisor.Supervisor) (*grpc.Server, error s := grpc.NewServer() types.RegisterAPIServer(s, server.NewServer(sv)) go func() { - glog.Infof("containerd: grpc api on %s", address) + glog.Infof("supervisord: grpc api on %s", address) if err := s.Serve(l); err != nil { - glog.Infof("containerd: serve grpc error") + glog.Infof("supervisord: serve grpc error") } }() return s, nil diff --git a/tty.go b/tty.go index 411623ce..a2be6ad4 100644 --- a/tty.go +++ b/tty.go @@ -6,8 +6,8 @@ import ( "os/signal" "syscall" - "github.com/docker/containerd/api/grpc/types" "github.com/hyperhq/runv/lib/term" + "github.com/hyperhq/runv/supervisord/api/grpc/types" netcontext "golang.org/x/net/context" )