Esempio n. 1
0
File: info.go Progetto: gnawux/hyper
func (daemon *Daemon) GetPodInfo(podName string) (*types.PodInfo, error) {
	var (
		p  *pod.XPod
		ok bool
	)
	p, ok = daemon.PodList.Get(podName)
	if !ok {
		return &types.PodInfo{}, fmt.Errorf("Can not get Pod info with pod ID(%s)", podName)
	}

	return p.Info()
}
Esempio n. 2
0
File: info.go Progetto: gnawux/hyper
func (daemon *Daemon) GetPodStats(podId string) (interface{}, error) {
	var (
		p  *pod.XPod
		ok bool
	)
	p, ok = daemon.PodList.Get(podId)
	if !ok {
		return nil, fmt.Errorf("Can not get Pod stats with pod ID(%s)", podId)
	}

	if !p.IsRunning() {
		return nil, fmt.Errorf("Can not get pod stats for non-running pod (%s)", podId)
	}

	response := p.Stats()
	if response == nil || response.Data == nil {
		return nil, fmt.Errorf("Stats for pod %s is nil", podId)
	}

	return response.Data, nil
}