Exemplo n.º 1
0
Arquivo: list.go Projeto: gnawux/hyper
// ContainerList implements GET /list?item=container
func (s *ServerRPC) ContainerList(ctx context.Context, req *types.ContainerListRequest) (*types.ContainerListResponse, error) {
	glog.V(3).Infof("ContainerList with request %s", req.String())

	containerList, err := s.daemon.ListContainers(req.PodID, req.VmID, req.Auxiliary)
	if err != nil {
		glog.Errorf("ContainerList error: %v", err)
		return nil, err
	}

	return &types.ContainerListResponse{
		ContainerList: containerList,
	}, nil
}
Exemplo n.º 2
0
Arquivo: list.go Projeto: juito/hyper
// ContainerList implements GET /list?item=container
func (s *ServerRPC) ContainerList(ctx context.Context, req *types.ContainerListRequest) (*types.ContainerListResponse, error) {
	glog.V(3).Infof("ContainerList with request %s", req.String())

	containerList, err := s.daemon.ListContainers(req.PodID, req.VmID, req.Auxiliary)
	if err != nil {
		glog.Errorf("ContainerList error: %v", err)
		return nil, err
	}

	result := make([]*types.ContainerListResult, 0, 1)
	for _, c := range containerList {
		result = append(result, &types.ContainerListResult{
			ContainerID:   c.Id,
			ContainerName: c.Name,
			PodID:         c.PodId,
			Status:        s.daemon.GetContainerStatus(c.Status),
		})
	}

	return &types.ContainerListResponse{
		ContainerList: result,
	}, nil
}