Esempio n. 1
0
File: list.go Progetto: 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
}
Esempio n. 2
0
File: list.go Progetto: 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
}