mirror of
https://github.com/containers/podman.git
synced 2025-10-27 19:34:13 +08:00
@ -92,7 +92,7 @@ func (c *Container) getContainerInspectData(size bool, driverData *define.Driver
|
||||
}
|
||||
|
||||
namedVolumes, mounts := c.sortUserVolumes(ctrSpec)
|
||||
inspectMounts, err := c.getInspectMounts(namedVolumes, c.config.ImageVolumes, mounts)
|
||||
inspectMounts, err := c.GetInspectMounts(namedVolumes, c.config.ImageVolumes, mounts)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -194,7 +194,7 @@ func (c *Container) getContainerInspectData(size bool, driverData *define.Driver
|
||||
// Get inspect-formatted mounts list.
|
||||
// Only includes user-specified mounts. Only includes bind mounts and named
|
||||
// volumes, not tmpfs volumes.
|
||||
func (c *Container) getInspectMounts(namedVolumes []*ContainerNamedVolume, imageVolumes []*ContainerImageVolume, mounts []spec.Mount) ([]define.InspectMount, error) {
|
||||
func (c *Container) GetInspectMounts(namedVolumes []*ContainerNamedVolume, imageVolumes []*ContainerImageVolume, mounts []spec.Mount) ([]define.InspectMount, error) {
|
||||
inspectMounts := []define.InspectMount{}
|
||||
|
||||
// No mounts, return early
|
||||
|
||||
@ -57,6 +57,8 @@ type InspectPodData struct {
|
||||
CPUQuota int64 `json:"cpu_quota,omitempty"`
|
||||
// CPUSetCPUs contains linux specific CPU data for the pod
|
||||
CPUSetCPUs string `json:"cpuset_cpus,omitempty"`
|
||||
// Mounts contains volume related information for the pod
|
||||
Mounts []InspectMount `json:"mounts,omitempty"`
|
||||
}
|
||||
|
||||
// InspectPodInfraConfig contains the configuration of the pod's infra
|
||||
|
||||
@ -582,6 +582,7 @@ func (p *Pod) Inspect() (*define.InspectPodData, error) {
|
||||
// Infra config contains detailed information on the pod's infra
|
||||
// container.
|
||||
var infraConfig *define.InspectPodInfraConfig
|
||||
var inspectMounts []define.InspectMount
|
||||
if p.state.InfraContainerID != "" {
|
||||
infra, err := p.runtime.GetContainer(p.state.InfraContainerID)
|
||||
if err != nil {
|
||||
@ -597,6 +598,11 @@ func (p *Pod) Inspect() (*define.InspectPodData, error) {
|
||||
infraConfig.CPUSetCPUs = p.ResourceLim().CPU.Cpus
|
||||
infraConfig.PidNS = p.PidMode()
|
||||
infraConfig.UserNS = p.UserNSMode()
|
||||
namedVolumes, mounts := infra.sortUserVolumes(infra.Config().Spec)
|
||||
inspectMounts, err = infra.GetInspectMounts(namedVolumes, infra.config.ImageVolumes, mounts)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(infra.Config().ContainerNetworkConfig.DNSServer) > 0 {
|
||||
infraConfig.DNSServer = make([]string, 0, len(infra.Config().ContainerNetworkConfig.DNSServer))
|
||||
@ -645,6 +651,7 @@ func (p *Pod) Inspect() (*define.InspectPodData, error) {
|
||||
CPUSetCPUs: p.ResourceLim().CPU.Cpus,
|
||||
CPUPeriod: p.CPUPeriod(),
|
||||
CPUQuota: p.CPUQuota(),
|
||||
Mounts: inspectMounts,
|
||||
}
|
||||
|
||||
return &inspectData, nil
|
||||
|
||||
Reference in New Issue
Block a user