Add cpuset-mems flag to 'ctr run' command
This flag allows cpuset.mems to be specified when running a container. If provided, the container will use only the defined memory nodes. Signed-off-by: Peteris Rudzusiks <rye@stripe.com>
This commit is contained in:
parent
f642c0a5f5
commit
f2bc737825
@ -86,6 +86,10 @@ var platformRunFlags = []cli.Flag{
|
||||
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
|
||||
@ -301,6 +305,10 @@ func NewContainer(ctx gocontext.Context, client *containerd.Client, context *cli
|
||||
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 {
|
||||
opts = append(opts, oci.WithCPUShares(uint64(shares)))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user