oci: Add debugs for container create failures

This makes it easier to debug container creation failures
by looking at cri-o logs.

Signed-off-by: Mrunal Patel <mpatel@redhat.com>
This commit is contained in:
Mrunal Patel 2017-06-14 07:33:07 -07:00
parent 6a79d25e8c
commit 62c9caeb83

View file

@ -180,7 +180,7 @@ func (r *Runtime) CreateContainer(c *Container, cgroupParent string) error {
if ss.err != nil { if ss.err != nil {
return fmt.Errorf("error reading container (probably exited) json message: %v", ss.err) return fmt.Errorf("error reading container (probably exited) json message: %v", ss.err)
} }
logrus.Infof("Received container pid: %d", ss.si.Pid) logrus.Debugf("Received container pid: %d", ss.si.Pid)
errorMessage := "" errorMessage := ""
if c.terminal { if c.terminal {
errorMessage = stderrBuf.String() errorMessage = stderrBuf.String()
@ -194,8 +194,10 @@ func (r *Runtime) CreateContainer(c *Container, cgroupParent string) error {
if ss.si.Pid == -1 { if ss.si.Pid == -1 {
if errorMessage != "" { if errorMessage != "" {
logrus.Debugf("Container creation error: %s", errorMessage)
return fmt.Errorf("container create failed: %s", errorMessage) return fmt.Errorf("container create failed: %s", errorMessage)
} }
logrus.Debugf("Container creation failed")
return fmt.Errorf("container create failed") return fmt.Errorf("container create failed")
} }
case <-time.After(ContainerCreateTimeout): case <-time.After(ContainerCreateTimeout):