diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-04-16 10:52:58 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-16 10:52:58 -0700 |
commit | 5def21140038fc34cee9707d3069bf52adc24577 (patch) | |
tree | 2582da76814b9eb636f11070b00a2dbb596754a5 /libpod/pod_api.go | |
parent | 8c4d4b58eee5e6d759199c36560af738aadc521d (diff) | |
parent | ba430bfe5ef65d5aa5ffa1fef0087da76aafcc35 (diff) | |
download | podman-5def21140038fc34cee9707d3069bf52adc24577.tar.gz podman-5def21140038fc34cee9707d3069bf52adc24577.tar.bz2 podman-5def21140038fc34cee9707d3069bf52adc24577.zip |
Merge pull request #5842 from baude/v2bloat2
podman v2 remove bloat v2
Diffstat (limited to 'libpod/pod_api.go')
-rw-r--r-- | libpod/pod_api.go | 49 |
1 files changed, 22 insertions, 27 deletions
diff --git a/libpod/pod_api.go b/libpod/pod_api.go index 200732652..ed4dc0727 100644 --- a/libpod/pod_api.go +++ b/libpod/pod_api.go @@ -431,9 +431,9 @@ func containerStatusFromContainers(allCtrs []*Container) (map[string]define.Cont } // Inspect returns a PodInspect struct to describe the pod -func (p *Pod) Inspect() (*PodInspect, error) { +func (p *Pod) Inspect() (*define.InspectPodData, error) { var ( - podContainers []PodContainerInfo + ctrs []define.InspectPodContainerInfo ) p.lock.Lock() @@ -444,14 +444,6 @@ func (p *Pod) Inspect() (*PodInspect, error) { containers, err := p.runtime.state.PodContainers(p) if err != nil { - return &PodInspect{}, err - } - ctrStatuses, err := containerStatusFromContainers(containers) - if err != nil { - return nil, err - } - status, err := CreatePodStatusResults(ctrStatuses) - if err != nil { return nil, err } for _, c := range containers { @@ -462,26 +454,29 @@ func (p *Pod) Inspect() (*PodInspect, error) { if err == nil { containerStatus = containerState.String() } - pc := PodContainerInfo{ + ctrs = append(ctrs, define.InspectPodContainerInfo{ ID: c.ID(), + Name: c.Name(), State: containerStatus, - } - podContainers = append(podContainers, pc) + }) + } + inspectData := define.InspectPodData{ + ID: p.ID(), + Name: p.Name(), + Namespace: p.Namespace(), + Created: p.CreatedTime(), + Hostname: "", + Labels: p.Labels(), + CreateCgroup: false, + CgroupParent: p.CgroupParent(), + CgroupPath: p.state.CgroupPath, + CreateInfra: false, + InfraContainerID: p.state.InfraContainerID, + InfraConfig: nil, + SharedNamespaces: nil, + NumContainers: uint(len(containers)), + Containers: ctrs, } - infraContainerID := p.state.InfraContainerID - config := new(PodConfig) - if err := JSONDeepCopy(p.config, config); err != nil { - return nil, err - } - inspectData := PodInspect{ - Config: config, - State: &PodInspectState{ - CgroupPath: p.state.CgroupPath, - InfraContainerID: infraContainerID, - Status: status, - }, - Containers: podContainers, - } return &inspectData, nil } |