Fixup pod sandbox status

Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
This commit is contained in:
Mrunal Patel 2016-09-23 14:47:47 -07:00
parent 6eab35c6b5
commit b839ff1093

View file

@ -302,16 +302,16 @@ func (s *Server) RemovePodSandbox(ctx context.Context, req *pb.RemovePodSandboxR
// PodSandboxStatus returns the Status of the PodSandbox. // PodSandboxStatus returns the Status of the PodSandbox.
func (s *Server) PodSandboxStatus(ctx context.Context, req *pb.PodSandboxStatusRequest) (*pb.PodSandboxStatusResponse, error) { func (s *Server) PodSandboxStatus(ctx context.Context, req *pb.PodSandboxStatusRequest) (*pb.PodSandboxStatusResponse, error) {
sbName := req.PodSandboxId sbID := req.PodSandboxId
if *sbName == "" { if *sbID == "" {
return nil, fmt.Errorf("PodSandboxId should not be empty") return nil, fmt.Errorf("PodSandboxId should not be empty")
} }
sb := s.getSandbox(*sbName) sb := s.getSandbox(*sbID)
if sb == nil { if sb == nil {
return nil, fmt.Errorf("specified sandbox not found: %s", *sbName) return nil, fmt.Errorf("specified sandbox not found: %s", *sbID)
} }
podInfraContainerName := *sbName + "-infra" podInfraContainerName := sb.name + "-infra"
podInfraContainer := sb.getContainer(podInfraContainerName) podInfraContainer := sb.getContainer(podInfraContainerName)
cState := s.runtime.ContainerStatus(podInfraContainer) cState := s.runtime.ContainerStatus(podInfraContainer)
@ -322,7 +322,7 @@ func (s *Server) PodSandboxStatus(ctx context.Context, req *pb.PodSandboxStatusR
return nil, err return nil, err
} }
podNamespace := "" podNamespace := ""
ip, err := s.netPlugin.GetContainerNetworkStatus(netNsPath, podNamespace, *sbName, podInfraContainerName) ip, err := s.netPlugin.GetContainerNetworkStatus(netNsPath, podNamespace, *sbID, podInfraContainerName)
if err != nil { if err != nil {
// ignore the error on network status // ignore the error on network status
ip = "" ip = ""
@ -330,7 +330,7 @@ func (s *Server) PodSandboxStatus(ctx context.Context, req *pb.PodSandboxStatusR
return &pb.PodSandboxStatusResponse{ return &pb.PodSandboxStatusResponse{
Status: &pb.PodSandboxStatus{ Status: &pb.PodSandboxStatus{
Id: sbName, Id: sbID,
CreatedAt: int64Ptr(created), CreatedAt: int64Ptr(created),
Linux: &pb.LinuxPodSandboxStatus{ Linux: &pb.LinuxPodSandboxStatus{
Namespaces: &pb.Namespace{ Namespaces: &pb.Namespace{