Excloude the event of sandbox containers from event stream

We should exclude the event of sandbox containers from event
stream in order to avoid outputting unexpected error print.

related #173

Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>
This commit is contained in:
Yanqiang Miao 2017-08-28 14:21:03 +08:00
parent e559804b37
commit b18542c586

View File

@ -97,6 +97,9 @@ func (c *criContainerdService) handleEvent(evt *events.Envelope) {
glog.V(2).Infof("TaskExit event %+v", e)
cntr, err := c.containerStore.Get(e.ContainerID)
if err != nil {
if _, err := c.sandboxStore.Get(e.ContainerID); err == nil {
return
}
glog.Errorf("Failed to get container %q: %v", e.ContainerID, err)
return
}
@ -142,6 +145,9 @@ func (c *criContainerdService) handleEvent(evt *events.Envelope) {
glog.V(2).Infof("TaskOOM event %+v", e)
cntr, err := c.containerStore.Get(e.ContainerID)
if err != nil {
if _, err := c.sandboxStore.Get(e.ContainerID); err == nil {
return
}
glog.Errorf("Failed to get container %q: %v", e.ContainerID, err)
}
err = cntr.Status.Update(func(status containerstore.Status) (containerstore.Status, error) {