From fd888e8f346872717dc4f1268543da7793c46693 Mon Sep 17 00:00:00 2001 From: Kenfe-Mickael Laventure Date: Tue, 29 Mar 2016 11:40:05 -0700 Subject: [PATCH] Return the runtime error message on failed pause and resume calls Signed-off-by: Kenfe-Mickael Laventure --- runtime/container_linux.go | 12 ++++++++++-- supervisor/update.go | 4 ++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/runtime/container_linux.go b/runtime/container_linux.go index d18a371..2969076 100644 --- a/runtime/container_linux.go +++ b/runtime/container_linux.go @@ -53,13 +53,21 @@ func (c *container) Runtime() string { func (c *container) Pause() error { args := c.runtimeArgs args = append(args, "pause", c.id) - return exec.Command(c.runtime, args...).Run() + b, err := exec.Command(c.runtime, args...).CombinedOutput() + if err != nil { + return fmt.Errorf(string(b)) + } + return nil } func (c *container) Resume() error { args := c.runtimeArgs args = append(args, "resume", c.id) - return exec.Command(c.runtime, args...).Run() + b, err := exec.Command(c.runtime, args...).CombinedOutput() + if err != nil { + return fmt.Errorf(string(b)) + } + return nil } func (c *container) Checkpoints() ([]Checkpoint, error) { diff --git a/supervisor/update.go b/supervisor/update.go index 7d34d82..803d025 100644 --- a/supervisor/update.go +++ b/supervisor/update.go @@ -23,7 +23,7 @@ func (s *Supervisor) updateContainer(t *UpdateTask) error { switch t.State { case runtime.Running: if err := container.Resume(); err != nil { - return ErrUnknownContainerStatus + return err } s.notifySubscribers(Event{ ID: t.ID, @@ -32,7 +32,7 @@ func (s *Supervisor) updateContainer(t *UpdateTask) error { }) case runtime.Paused: if err := container.Pause(); err != nil { - return ErrUnknownContainerStatus + return err } s.notifySubscribers(Event{ ID: t.ID,