From a854b14193b62c93bd62ccddebca29a77c8c07a2 Mon Sep 17 00:00:00 2001
From: zhangsong34 <zhangsong34@huawei.com>
Date: Fri, 8 Mar 2019 14:32:39 +0800
Subject: [PATCH] runc:  just warning when poststart and poststop
 failed

reason:just warning when poststart and poststop failed.

Change-Id: I65e816c344506bbf9ea2f8c5ff4dc2d47cc0a35e
Signed-off-by: mashimiao <mashimiao@huawei.com>
Signed-off-by: zhangsong34 <zhangsong34@huawei.com>
---
 libcontainer/container_linux.go | 3 +--
 libcontainer/state_linux.go     | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/libcontainer/container_linux.go b/libcontainer/container_linux.go
index 5a3705e..1f587c7 100644
--- a/libcontainer/container_linux.go
+++ b/libcontainer/container_linux.go
@@ -341,11 +341,10 @@ func (c *linuxContainer) start(process *Process) error {
 			for i, hook := range c.config.Hooks.Poststart {
 				logrus.Infof("run poststart hook %d:%s, ContainerID: %s", i, hook.Info(), s.ID)
 				if err := hook.Run(s); err != nil {
-					logrus.Errorf("running poststart hook(%d:%s) failed: %s", i, hook.Info(), err)
+					logrus.Warnf("running poststart hook %d:%s failed: %s, ContainerId: %s", i, hook.Info(), err, s.ID)
 					if err := parent.terminate(); err != nil {
 						logrus.Warnf("run poststart hook failed: %s, ContainerID: %s", err, s.ID)
 					}
-					return newSystemErrorWithCausef(err, "running poststart hook %d:%s, ContainerID: %s", i, hook.Info(), s.ID)
 				}
 			}
 		}
diff --git a/libcontainer/state_linux.go b/libcontainer/state_linux.go
index 6fa62c0..b570a24 100644
--- a/libcontainer/state_linux.go
+++ b/libcontainer/state_linux.go
@@ -68,8 +68,7 @@ func runPoststopHooks(c *linuxContainer) error {
 		for i, hook := range c.config.Hooks.Poststop {
 			logrus.Infof("run poststop hook %d:%s, ContainerID: %s", i, hook.Info(), s.ID)
 			if err := hook.Run(s); err != nil {
-				logrus.Errorf("running poststop hook %d: %s failed: %s", i, hook.Info(), err)
-				return newSystemErrorWithCausef(err, "running poststop hook %d:%s, ContainerID: %s", i, hook.Info(), s.ID)
+				logrus.Warnf("running poststop hook %d:%s failed: %s, ContainerID: %s", i, hook.Info(), err, s.ID)
 			}
 		}
 	}
-- 
1.8.3.1

