diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-10-01 10:53:14 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-01 10:53:14 -0400 |
commit | 81aabc80545873a1ea6f7707a904997f1b400855 (patch) | |
tree | f918ca6a05abcf0be9e7155ca6554a42549244c8 /libpod/pod_api.go | |
parent | 285c9ec69b7c48467d183d2507cbd4163b9c21c9 (diff) | |
parent | 2d86051893fc2e813f26c16d13786bb377c26d48 (diff) | |
download | podman-81aabc80545873a1ea6f7707a904997f1b400855.tar.gz podman-81aabc80545873a1ea6f7707a904997f1b400855.tar.bz2 podman-81aabc80545873a1ea6f7707a904997f1b400855.zip |
Merge pull request #11686 from cdoern/podDeviceOptions
Pod Device-Read-BPS support
Diffstat (limited to 'libpod/pod_api.go')
-rw-r--r-- | libpod/pod_api.go | 54 |
1 files changed, 31 insertions, 23 deletions
diff --git a/libpod/pod_api.go b/libpod/pod_api.go index 971309f77..05349aff5 100644 --- a/libpod/pod_api.go +++ b/libpod/pod_api.go @@ -584,6 +584,7 @@ func (p *Pod) Inspect() (*define.InspectPodData, error) { var infraConfig *define.InspectPodInfraConfig var inspectMounts []define.InspectMount var devices []define.InspectDevice + var deviceLimits []define.InspectBlkioThrottleDevice if p.state.InfraContainerID != "" { infra, err := p.runtime.GetContainer(p.state.InfraContainerID) if err != nil { @@ -604,12 +605,18 @@ func (p *Pod) Inspect() (*define.InspectPodData, error) { if err != nil { return nil, err } - var nodes map[string]string devices, err = infra.GetDevices(false, *infra.config.Spec, nodes) if err != nil { return nil, err } + spec := infra.config.Spec + if spec.Linux != nil && spec.Linux.Resources != nil && spec.Linux.Resources.BlockIO != nil { + deviceLimits, err = blkioDeviceThrottle(nodes, spec.Linux.Resources.BlockIO.ThrottleReadBpsDevice) + if err != nil { + return nil, err + } + } if len(infra.config.ContainerNetworkConfig.DNSServer) > 0 { infraConfig.DNSServer = make([]string, 0, len(infra.config.ContainerNetworkConfig.DNSServer)) @@ -638,28 +645,29 @@ func (p *Pod) Inspect() (*define.InspectPodData, error) { } inspectData := define.InspectPodData{ - ID: p.ID(), - Name: p.Name(), - Namespace: p.Namespace(), - Created: p.CreatedTime(), - CreateCommand: p.config.CreateCommand, - State: podState, - Hostname: p.config.Hostname, - Labels: p.Labels(), - CreateCgroup: p.config.UsePodCgroup, - CgroupParent: p.CgroupParent(), - CgroupPath: p.state.CgroupPath, - CreateInfra: infraConfig != nil, - InfraContainerID: p.state.InfraContainerID, - InfraConfig: infraConfig, - SharedNamespaces: sharesNS, - NumContainers: uint(len(containers)), - Containers: ctrs, - CPUSetCPUs: p.ResourceLim().CPU.Cpus, - CPUPeriod: p.CPUPeriod(), - CPUQuota: p.CPUQuota(), - Mounts: inspectMounts, - Devices: devices, + ID: p.ID(), + Name: p.Name(), + Namespace: p.Namespace(), + Created: p.CreatedTime(), + CreateCommand: p.config.CreateCommand, + State: podState, + Hostname: p.config.Hostname, + Labels: p.Labels(), + CreateCgroup: p.config.UsePodCgroup, + CgroupParent: p.CgroupParent(), + CgroupPath: p.state.CgroupPath, + CreateInfra: infraConfig != nil, + InfraContainerID: p.state.InfraContainerID, + InfraConfig: infraConfig, + SharedNamespaces: sharesNS, + NumContainers: uint(len(containers)), + Containers: ctrs, + CPUSetCPUs: p.ResourceLim().CPU.Cpus, + CPUPeriod: p.CPUPeriod(), + CPUQuota: p.CPUQuota(), + Mounts: inspectMounts, + Devices: devices, + BlkioDeviceReadBps: deviceLimits, } return &inspectData, nil |