server: do not add ctrs with bad state when restoring

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
Antonio Murdaca 2016-12-22 11:11:14 +01:00 committed by Nalin Dahyabhai
parent c61a83a930
commit 437459bd64

View file

@ -107,6 +107,7 @@ func (s *Server) loadContainer(id string) error {
s.addContainer(ctr) s.addContainer(ctr)
if err = s.runtime.UpdateStatus(ctr); err != nil { if err = s.runtime.UpdateStatus(ctr); err != nil {
logrus.Warnf("error updating status for container %s: %v", ctr.ID(), err) logrus.Warnf("error updating status for container %s: %v", ctr.ID(), err)
return nil
} }
if err = s.ctrIDIndex.Add(id); err != nil { if err = s.ctrIDIndex.Add(id); err != nil {
return err return err
@ -213,6 +214,7 @@ func (s *Server) loadSandbox(id string) error {
sb.infraContainer = scontainer sb.infraContainer = scontainer
if err = s.runtime.UpdateStatus(scontainer); err != nil { if err = s.runtime.UpdateStatus(scontainer); err != nil {
logrus.Warnf("error updating status for pod sandbox infra container %s: %v", scontainer.ID(), err) logrus.Warnf("error updating status for pod sandbox infra container %s: %v", scontainer.ID(), err)
return nil
} }
if err = s.ctrIDIndex.Add(scontainer.ID()); err != nil { if err = s.ctrIDIndex.Add(scontainer.ID()); err != nil {
return err return err