aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd/podman/common/create.go32
-rw-r--r--docs/source/markdown/podman-pod-create.1.md16
-rw-r--r--libpod/define/pod_inspect.go12
-rw-r--r--libpod/pod.go89
-rw-r--r--libpod/pod_api.go6
5 files changed, 16 insertions, 139 deletions
diff --git a/cmd/podman/common/create.go b/cmd/podman/common/create.go
index 325c1dc69..f3bf2c0a2 100644
--- a/cmd/podman/common/create.go
+++ b/cmd/podman/common/create.go
@@ -90,6 +90,22 @@ func DefineCreateFlags(cmd *cobra.Command, cf *entities.ContainerCreateOptions,
)
_ = cmd.RegisterFlagCompletionFunc(cgroupsFlagName, AutocompleteCgroupMode)
+ cpusFlagName := "cpus"
+ createFlags.Float64Var(
+ &cf.CPUS,
+ cpusFlagName, 0,
+ "Number of CPUs. The default is 0.000 which means no limit",
+ )
+ _ = cmd.RegisterFlagCompletionFunc(cpusFlagName, completion.AutocompleteNone)
+
+ cpusetCpusFlagName := "cpuset-cpus"
+ createFlags.StringVar(
+ &cf.CPUSetCPUs,
+ cpusetCpusFlagName, "",
+ "CPUs in which to allow execution (0-3, 0,1)",
+ )
+ _ = cmd.RegisterFlagCompletionFunc(cpusetCpusFlagName, completion.AutocompleteNone)
+
cpuPeriodFlagName := "cpu-period"
createFlags.Uint64Var(
&cf.CPUPeriod,
@@ -784,22 +800,6 @@ func DefineCreateFlags(cmd *cobra.Command, cf *entities.ContainerCreateOptions,
)
_ = cmd.RegisterFlagCompletionFunc(conmonPidfileFlagName, completion.AutocompleteDefault)
- cpusFlagName := "cpus"
- createFlags.Float64Var(
- &cf.CPUS,
- cpusFlagName, 0,
- "Number of CPUs. The default is 0.000 which means no limit",
- )
- _ = cmd.RegisterFlagCompletionFunc(cpusFlagName, completion.AutocompleteNone)
-
- cpusetCpusFlagName := "cpuset-cpus"
- createFlags.StringVar(
- &cf.CPUSetCPUs,
- cpusetCpusFlagName, "",
- "CPUs in which to allow execution (0-3, 0,1)",
- )
- _ = cmd.RegisterFlagCompletionFunc(cpusetCpusFlagName, completion.AutocompleteNone)
-
entrypointFlagName := ""
if !isInfra {
entrypointFlagName = "entrypoint"
diff --git a/docs/source/markdown/podman-pod-create.1.md b/docs/source/markdown/podman-pod-create.1.md
index fc7d39754..5909bdaf0 100644
--- a/docs/source/markdown/podman-pod-create.1.md
+++ b/docs/source/markdown/podman-pod-create.1.md
@@ -23,22 +23,6 @@ Add a host to the /etc/hosts file shared between all containers in the pod.
Path to cgroups under which the cgroup for the pod will be created. If the path is not absolute, the path is considered to be relative to the cgroups path of the init process. Cgroups will be created if they do not already exist.
-#### **--cpus**=*amount*
-
-Set the total number of CPUs delegated to the pod. Default is 0.000 which indicates that there is no limit on computation power.
-
-#### **--cpuset-cpus**=*amount*
-
-Limit the CPUs to support execution. First CPU is numbered 0. Unlike --cpus this is of type string and parsed as a list of numbers
-
-Format is 0-3,0,1
-
-Examples of the List Format:
-
-0-4,9 # bits 0, 1, 2, 3, 4, and 9 set
-0-2,7,12-14 # bits 0, 1, 2, 7, 12, 13, and 14 set
-
-
#### **--dns**=*ipaddr*
Set custom DNS servers in the /etc/resolv.conf file that will be shared between all containers in the pod. A special option, "none" is allowed which disables creation of /etc/resolv.conf for the pod.
diff --git a/libpod/define/pod_inspect.go b/libpod/define/pod_inspect.go
index f91fd198d..b88d4f279 100644
--- a/libpod/define/pod_inspect.go
+++ b/libpod/define/pod_inspect.go
@@ -51,12 +51,6 @@ type InspectPodData struct {
// Containers gives a brief summary of all containers in the pod and
// their current status.
Containers []InspectPodContainerInfo `json:"Containers,omitempty"`
- // CPUPeriod contains the CPU period of the pod
- CPUPeriod uint64 `json:"cpu_period,omitempty"`
- // CPUQuota contains the CPU quota of the pod
- CPUQuota int64 `json:"cpu_quota,omitempty"`
- // CPUSetCPUs contains linux specific CPU data for the pod
- CPUSetCPUs string `json:"cpuset_cpus,omitempty"`
}
// InspectPodInfraConfig contains the configuration of the pod's infra
@@ -97,12 +91,6 @@ type InspectPodInfraConfig struct {
Networks []string
// NetworkOptions are additional options for each network
NetworkOptions map[string][]string
- // CPUPeriod contains the CPU period of the pod
- CPUPeriod uint64 `json:"cpu_period,omitempty"`
- // CPUQuota contains the CPU quota of the pod
- CPUQuota int64 `json:"cpu_quota,omitempty"`
- // CPUSetCPUs contains linux specific CPU data for the container
- CPUSetCPUs string `json:"cpuset_cpus,omitempty"`
// Pid is the PID namespace mode of the pod's infra container
PidNS string `json:"pid_ns,omitempty"`
// UserNS is the usernamespace that all the containers in the pod will join.
diff --git a/libpod/pod.go b/libpod/pod.go
index e4516b354..0d5d629cd 100644
--- a/libpod/pod.go
+++ b/libpod/pod.go
@@ -1,7 +1,6 @@
package libpod
import (
- "context"
"fmt"
"sort"
"time"
@@ -99,65 +98,6 @@ func (p *Pod) Namespace() string {
return p.config.Namespace
}
-// ResourceLim returns the cpuset resource limits for the pod
-func (p *Pod) ResourceLim() *specs.LinuxResources {
- resCopy := &specs.LinuxResources{}
- empty := &specs.LinuxResources{
- CPU: &specs.LinuxCPU{},
- }
- infra, err := p.runtime.GetContainer(p.state.InfraContainerID)
- if err != nil {
- return empty
- }
- conf := infra.config.Spec
- if err != nil {
- return empty
- }
- if conf.Linux == nil || conf.Linux.Resources == nil {
- return empty
- }
- if err = JSONDeepCopy(conf.Linux.Resources, resCopy); err != nil {
- return nil
- }
- if resCopy.CPU != nil {
- return resCopy
- }
-
- return empty
-}
-
-// CPUPeriod returns the pod CPU period
-func (p *Pod) CPUPeriod() uint64 {
- if p.state.InfraContainerID == "" {
- return 0
- }
- infra, err := p.runtime.GetContainer(p.state.InfraContainerID)
- if err != nil {
- return 0
- }
- conf := infra.config.Spec
- if conf != nil && conf.Linux != nil && conf.Linux.Resources != nil && conf.Linux.Resources.CPU != nil && conf.Linux.Resources.CPU.Period != nil {
- return *conf.Linux.Resources.CPU.Period
- }
- return 0
-}
-
-// CPUQuota returns the pod CPU quota
-func (p *Pod) CPUQuota() int64 {
- if p.state.InfraContainerID == "" {
- return 0
- }
- infra, err := p.runtime.GetContainer(p.state.InfraContainerID)
- if err != nil {
- return 0
- }
- conf := infra.config.Spec
- if conf != nil && conf.Linux != nil && conf.Linux.Resources != nil && conf.Linux.Resources.CPU != nil && conf.Linux.Resources.CPU.Quota != nil {
- return *conf.Linux.Resources.CPU.Quota
- }
- return 0
-}
-
// PidMode returns the PID mode given by the user ex: pod, private...
func (p *Pod) PidMode() string {
infra, err := p.runtime.GetContainer(p.state.InfraContainerID)
@@ -282,35 +222,6 @@ func (p *Pod) CgroupPath() (string, error) {
if err := p.updatePod(); err != nil {
return "", err
}
- if p.state.CgroupPath != "" {
- return p.state.CgroupPath, nil
- }
- if p.state.InfraContainerID == "" {
- return "", errors.Wrap(define.ErrNoSuchCtr, "pod has no infra container")
- }
-
- id, err := p.infraContainerID()
- if err != nil {
- return "", err
- }
-
- if id != "" {
- ctr, err := p.infraContainer()
- if err != nil {
- return "", errors.Wrapf(err, "could not get infra")
- }
- if ctr != nil {
- ctr.Start(context.Background(), true)
- cgroupPath, err := ctr.CGroupPath()
- fmt.Println(cgroupPath)
- if err != nil {
- return "", errors.Wrapf(err, "could not get container cgroup")
- }
- p.state.CgroupPath = cgroupPath
- p.save()
- return cgroupPath, nil
- }
- }
return p.state.CgroupPath, nil
}
diff --git a/libpod/pod_api.go b/libpod/pod_api.go
index 5f4d983b9..4c3b1b0b7 100644
--- a/libpod/pod_api.go
+++ b/libpod/pod_api.go
@@ -592,9 +592,6 @@ func (p *Pod) Inspect() (*define.InspectPodData, error) {
infraConfig.StaticIP = infra.Config().ContainerNetworkConfig.StaticIP
infraConfig.NoManageResolvConf = infra.Config().UseImageResolvConf
infraConfig.NoManageHosts = infra.Config().UseImageHosts
- infraConfig.CPUPeriod = p.CPUPeriod()
- infraConfig.CPUQuota = p.CPUQuota()
- infraConfig.CPUSetCPUs = p.ResourceLim().CPU.Cpus
infraConfig.PidNS = p.PidMode()
infraConfig.UserNS = p.UserNSMode()
@@ -642,9 +639,6 @@ func (p *Pod) Inspect() (*define.InspectPodData, error) {
SharedNamespaces: sharesNS,
NumContainers: uint(len(containers)),
Containers: ctrs,
- CPUSetCPUs: p.ResourceLim().CPU.Cpus,
- CPUPeriod: p.CPUPeriod(),
- CPUQuota: p.CPUQuota(),
}
return &inspectData, nil