Add inotify watcher for container exits

This allows the container list API to return updated status
for exited container without having to call container status first.

Signed-off-by: Mrunal Patel <mpatel@redhat.com>
This commit is contained in:
Mrunal Patel 2017-08-12 18:35:55 -07:00
parent 8f735a581d
commit 30ded83096
7 changed files with 97 additions and 23 deletions

View file

@ -2,6 +2,8 @@ package server
import (
"fmt"
"os"
"path/filepath"
"github.com/kubernetes-incubator/cri-o/oci"
"github.com/sirupsen/logrus"
@ -36,6 +38,10 @@ func (s *Server) RemoveContainer(ctx context.Context, req *pb.RemoveContainerReq
return nil, fmt.Errorf("failed to delete container %s: %v", c.ID(), err)
}
if err := os.Remove(filepath.Join(s.config.ContainerExitsDir, c.ID())); err != nil {
return nil, fmt.Errorf("failed to remove container exit file %s: %v", c.ID(), err)
}
s.removeContainer(c)
if err := s.StorageRuntimeServer().DeleteContainer(c.ID()); err != nil {