summaryrefslogtreecommitdiff
path: root/libpod/pod_api.go
diff options
context:
space:
mode:
authorBrent Baude <bbaude@redhat.com>2020-04-16 08:39:34 -0500
committerBrent Baude <bbaude@redhat.com>2020-04-16 12:04:46 -0500
commitba430bfe5ef65d5aa5ffa1fef0087da76aafcc35 (patch)
tree3554a8bc2a5add5feee1d008d594665f82279fb3 /libpod/pod_api.go
parent8857ba20a0651e8fa71762da90d774e3aa290883 (diff)
downloadpodman-ba430bfe5ef65d5aa5ffa1fef0087da76aafcc35.tar.gz
podman-ba430bfe5ef65d5aa5ffa1fef0087da76aafcc35.tar.bz2
podman-ba430bfe5ef65d5aa5ffa1fef0087da76aafcc35.zip
podman v2 remove bloat v2
rid ourseleves of libpod references in v2 client Signed-off-by: Brent Baude <bbaude@redhat.com>
Diffstat (limited to 'libpod/pod_api.go')
-rw-r--r--libpod/pod_api.go49
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
}