mirror of
https://github.com/containers/podman.git
synced 2025-06-23 02:18:13 +08:00
libpod, inspect: export cgroup path
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
@ -97,6 +97,16 @@ func (c *Container) getContainerInspectData(size bool, driverData *define.Driver
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cgroupPath, err := c.cGroupPath()
|
||||||
|
if err != nil {
|
||||||
|
// Handle the case where the container is not running or has no cgroup.
|
||||||
|
if errors.Is(err, define.ErrNoCgroups) || errors.Is(err, define.ErrCtrStopped) {
|
||||||
|
cgroupPath = ""
|
||||||
|
} else {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
data := &define.InspectContainerData{
|
data := &define.InspectContainerData{
|
||||||
ID: config.ID,
|
ID: config.ID,
|
||||||
Created: config.CreatedTime,
|
Created: config.CreatedTime,
|
||||||
@ -116,6 +126,7 @@ func (c *Container) getContainerInspectData(size bool, driverData *define.Driver
|
|||||||
StartedAt: runtimeInfo.StartedTime,
|
StartedAt: runtimeInfo.StartedTime,
|
||||||
FinishedAt: runtimeInfo.FinishedTime,
|
FinishedAt: runtimeInfo.FinishedTime,
|
||||||
Checkpointed: runtimeInfo.Checkpointed,
|
Checkpointed: runtimeInfo.Checkpointed,
|
||||||
|
CgroupPath: cgroupPath,
|
||||||
},
|
},
|
||||||
Image: config.RootfsImageID,
|
Image: config.RootfsImageID,
|
||||||
ImageName: config.RootfsImageName,
|
ImageName: config.RootfsImageName,
|
||||||
|
@ -204,6 +204,7 @@ type InspectContainerState struct {
|
|||||||
FinishedAt time.Time `json:"FinishedAt"`
|
FinishedAt time.Time `json:"FinishedAt"`
|
||||||
Health HealthCheckResults `json:"Health,omitempty"`
|
Health HealthCheckResults `json:"Health,omitempty"`
|
||||||
Checkpointed bool `json:"Checkpointed,omitempty"`
|
Checkpointed bool `json:"Checkpointed,omitempty"`
|
||||||
|
CgroupPath string `json:"CgroupPath,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Healthcheck returns the HealthCheckResults. This is used for old podman compat
|
// Healthcheck returns the HealthCheckResults. This is used for old podman compat
|
||||||
|
Reference in New Issue
Block a user