Merge pull request #172 from mrunalp/more_debugs

Add more debugs
This commit is contained in:
Antonio Murdaca 2016-10-22 09:17:34 +02:00 committed by GitHub
commit ed3a56fd29
3 changed files with 12 additions and 2 deletions

View file

@ -58,6 +58,7 @@ func (s *Server) getContainerFromRequest(req containerRequest) (*oci.Container,
// CreateContainer creates a new container in specified PodSandbox
func (s *Server) CreateContainer(ctx context.Context, req *pb.CreateContainerRequest) (res *pb.CreateContainerResponse, err error) {
logrus.Debugf("CreateContainer %+v", req)
sbID := req.GetPodSandboxId()
if sbID == "" {
return nil, fmt.Errorf("PodSandboxId should not be empty")
@ -347,6 +348,7 @@ func (s *Server) createSandboxContainer(containerID string, containerName string
// StartContainer starts the container.
func (s *Server) StartContainer(ctx context.Context, req *pb.StartContainerRequest) (*pb.StartContainerResponse, error) {
logrus.Debugf("StartContainer %+v", req)
c, err := s.getContainerFromRequest(req)
if err != nil {
return nil, err
@ -361,6 +363,7 @@ func (s *Server) StartContainer(ctx context.Context, req *pb.StartContainerReque
// StopContainer stops a running container with a grace period (i.e., timeout).
func (s *Server) StopContainer(ctx context.Context, req *pb.StopContainerRequest) (*pb.StopContainerResponse, error) {
logrus.Debugf("StopContainer %+v", req)
c, err := s.getContainerFromRequest(req)
if err != nil {
return nil, err
@ -376,6 +379,7 @@ func (s *Server) StopContainer(ctx context.Context, req *pb.StopContainerRequest
// RemoveContainer removes the container. If the container is running, the container
// should be force removed.
func (s *Server) RemoveContainer(ctx context.Context, req *pb.RemoveContainerRequest) (*pb.RemoveContainerResponse, error) {
logrus.Debugf("RemoveContainer %+v", req)
c, err := s.getContainerFromRequest(req)
if err != nil {
return nil, err
@ -431,6 +435,7 @@ func filterContainer(c *pb.Container, filter *pb.ContainerFilter) bool {
// ListContainers lists all containers by filters.
func (s *Server) ListContainers(ctx context.Context, req *pb.ListContainersRequest) (*pb.ListContainersResponse, error) {
logrus.Debugf("ListContainers %+v", req)
var ctrs []*pb.Container
filter := req.Filter
ctrList := s.state.containers.List()
@ -504,6 +509,7 @@ func (s *Server) ListContainers(ctx context.Context, req *pb.ListContainersReque
// ContainerStatus returns status of the container.
func (s *Server) ContainerStatus(ctx context.Context, req *pb.ContainerStatusRequest) (*pb.ContainerStatusResponse, error) {
logrus.Debugf("ContainerStatus %+v", req)
c, err := s.getContainerFromRequest(req)
if err != nil {
return nil, err

View file

@ -85,6 +85,7 @@ func (s *Server) getPodSandboxFromRequest(req podSandboxRequest) (*sandbox, erro
// RunPodSandbox creates and runs a pod-level sandbox.
func (s *Server) RunPodSandbox(ctx context.Context, req *pb.RunPodSandboxRequest) (*pb.RunPodSandboxResponse, error) {
logrus.Debugf("RunPodSandbox %+v", req)
var processLabel, mountLabel string
// process req.Name
name := req.GetConfig().GetMetadata().GetName()
@ -324,6 +325,7 @@ func (s *Server) RunPodSandbox(ctx context.Context, req *pb.RunPodSandboxRequest
// StopPodSandbox stops the sandbox. If there are any running containers in the
// sandbox, they should be force terminated.
func (s *Server) StopPodSandbox(ctx context.Context, req *pb.StopPodSandboxRequest) (*pb.StopPodSandboxResponse, error) {
logrus.Debugf("StopPodSandbox %+v", req)
sb, err := s.getPodSandboxFromRequest(req)
if err != nil {
return nil, err
@ -355,6 +357,7 @@ func (s *Server) StopPodSandbox(ctx context.Context, req *pb.StopPodSandboxReque
// RemovePodSandbox deletes the sandbox. If there are any running containers in the
// sandbox, they should be force deleted.
func (s *Server) RemovePodSandbox(ctx context.Context, req *pb.RemovePodSandboxRequest) (*pb.RemovePodSandboxResponse, error) {
logrus.Debugf("RemovePodSandbox %+v", req)
sb, err := s.getPodSandboxFromRequest(req)
if err != nil {
return nil, err
@ -414,6 +417,7 @@ func (s *Server) RemovePodSandbox(ctx context.Context, req *pb.RemovePodSandboxR
// PodSandboxStatus returns the Status of the PodSandbox.
func (s *Server) PodSandboxStatus(ctx context.Context, req *pb.PodSandboxStatusRequest) (*pb.PodSandboxStatusResponse, error) {
logrus.Debugf("PodSandboxStatus %+v", req)
sb, err := s.getPodSandboxFromRequest(req)
if err != nil {
return nil, err
@ -483,6 +487,7 @@ func filterSandbox(p *pb.PodSandbox, filter *pb.PodSandboxFilter) bool {
// ListPodSandbox returns a list of SandBoxes.
func (s *Server) ListPodSandbox(ctx context.Context, req *pb.ListPodSandboxRequest) (*pb.ListPodSandboxResponse, error) {
logrus.Debugf("ListPodSandbox %+v", req)
var pods []*pb.PodSandbox
var podList []*sandbox
for _, sb := range s.state.sandboxes {

View file

@ -144,7 +144,6 @@ func StartReaper() {
for {
// Wait for a child to terminate
sig := <-sigs
logrus.Infof("Signal received: %v", sig)
for {
// Reap processes
cpid, _ := syscall.Wait4(-1, nil, syscall.WNOHANG, nil)
@ -152,7 +151,7 @@ func StartReaper() {
break
}
logrus.Infof("Reaped process with pid %d", cpid)
logrus.Debugf("Reaped process with pid %d %v", cpid, sig)
}
}
}()