add cpu-shares to ctr
This allows the cpu shares to be modified via ctr. Signed-off-by: Michael Crosby <michael@thepasture.io>
This commit is contained in:
@@ -70,6 +70,11 @@ var platformRunFlags = []cli.Flag{
|
||||
Usage: "set the CFS cpu quota",
|
||||
Value: 0.0,
|
||||
},
|
||||
cli.IntFlag{
|
||||
Name: "cpu-shares",
|
||||
Usage: "set the cpu shares",
|
||||
Value: 1024,
|
||||
},
|
||||
cli.BoolFlag{
|
||||
Name: "cni",
|
||||
Usage: "enable cni networking for the container",
|
||||
@@ -226,6 +231,10 @@ func NewContainer(ctx gocontext.Context, client *containerd.Client, context *cli
|
||||
opts = append(opts, oci.WithCPUCFS(quota, period))
|
||||
}
|
||||
|
||||
if shares := context.Int("cpu-shares"); shares > 0 {
|
||||
opts = append(opts, oci.WithCPUShares(uint64(shares)))
|
||||
}
|
||||
|
||||
quota := context.Int64("cpu-quota")
|
||||
period := context.Uint64("cpu-period")
|
||||
if quota != -1 || period != 0 {
|
||||
|
Reference in New Issue
Block a user