Merge pull request #8601 from rye-stripe/add-ctr-run-flags
Add cpuset flags to 'ctr run'
This commit is contained in:
commit
bd7f543869
@ -82,6 +82,14 @@ var platformRunFlags = []cli.Flag{
|
|||||||
Usage: "Set the cpu shares",
|
Usage: "Set the cpu shares",
|
||||||
Value: 1024,
|
Value: 1024,
|
||||||
},
|
},
|
||||||
|
cli.StringFlag{
|
||||||
|
Name: "cpuset-cpus",
|
||||||
|
Usage: "Set the CPUs the container will run in (e.g., 1-2,4)",
|
||||||
|
},
|
||||||
|
cli.StringFlag{
|
||||||
|
Name: "cpuset-mems",
|
||||||
|
Usage: "Set the memory nodes the container will run in (e.g., 1-2,4)",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewContainer creates a new container
|
// NewContainer creates a new container
|
||||||
@ -293,6 +301,14 @@ func NewContainer(ctx gocontext.Context, client *containerd.Client, context *cli
|
|||||||
opts = append(opts, oci.WithCPUCFS(quota, period))
|
opts = append(opts, oci.WithCPUCFS(quota, period))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if cpusetCpus := context.String("cpuset-cpus"); len(cpusetCpus) > 0 {
|
||||||
|
opts = append(opts, oci.WithCPUs(cpusetCpus))
|
||||||
|
}
|
||||||
|
|
||||||
|
if cpusetMems := context.String("cpuset-mems"); len(cpusetMems) > 0 {
|
||||||
|
opts = append(opts, oci.WithCPUsMems(cpusetMems))
|
||||||
|
}
|
||||||
|
|
||||||
if shares := context.Int("cpu-shares"); shares > 0 {
|
if shares := context.Int("cpu-shares"); shares > 0 {
|
||||||
opts = append(opts, oci.WithCPUShares(uint64(shares)))
|
opts = append(opts, oci.WithCPUShares(uint64(shares)))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user