From 9f5caf529c61429a83f9050afb09645e01311f7d Mon Sep 17 00:00:00 2001 From: Alexander Morozov Date: Tue, 8 Dec 2015 09:37:31 -0800 Subject: [PATCH] Add logging for started supervisor Signed-off-by: Alexander Morozov --- linux/linux.go | 4 ++++ runc/runc.go | 4 ++++ runtime/runtime.go | 1 + supervisor.go | 4 ++++ 4 files changed, 13 insertions(+) diff --git a/linux/linux.go b/linux/linux.go index 92110c4df..8a97b4f65 100644 --- a/linux/linux.go +++ b/linux/linux.go @@ -343,6 +343,10 @@ type libcontainerRuntime struct { factory libcontainer.Factory } +func (r *libcontainerRuntime) Type() string { + return "libcontainer" +} + func (r *libcontainerRuntime) Create(id, bundlePath string, stdio *runtime.Stdio) (runtime.Container, error) { spec, rspec, err := r.loadSpec( filepath.Join(bundlePath, "config.json"), diff --git a/runc/runc.go b/runc/runc.go index 967ddc9fc..ff429cbdb 100644 --- a/runc/runc.go +++ b/runc/runc.go @@ -135,6 +135,10 @@ type runcRuntime struct { stateDir string } +func (r *runcRuntime) Type() string { + return "runc" +} + func (r *runcRuntime) Create(id, bundlePath string, stdio *runtime.Stdio) (runtime.Container, error) { cmd := exec.Command("runc", "--root", r.stateDir, "--id", id, "start") cmd.Dir = bundlePath diff --git a/runtime/runtime.go b/runtime/runtime.go index b92861a94..5a5e0d937 100644 --- a/runtime/runtime.go +++ b/runtime/runtime.go @@ -17,4 +17,5 @@ var ( type Runtime interface { Create(id, bundlePath string, stdio *Stdio) (Container, error) StartProcess(Container, specs.Process, *Stdio) (Process, error) + Type() string } diff --git a/supervisor.go b/supervisor.go index d411a305d..b3938b2c2 100644 --- a/supervisor.go +++ b/supervisor.go @@ -149,6 +149,10 @@ func (s *Supervisor) Start() error { close(e.Err) } }() + logrus.WithFields(logrus.Fields{ + "runtime": s.runtime.Type(), + "stateDir": s.stateDir, + }).Debug("Supervisor started") return nil }