Add --cpu-quota, --cpu-period flag to ctr
Signed-off-by: Kenneth Kang <kenneth.kang@lge.com>
This commit is contained in:
parent
85b15eff45
commit
e20a5079e8
@ -29,5 +29,12 @@ func init() {
|
||||
}, cli.BoolFlag{
|
||||
Name: "no-pivot",
|
||||
Usage: "disable use of pivot-root (linux only)",
|
||||
}, cli.Int64Flag{
|
||||
Name: "cpu-quota",
|
||||
Usage: "Limit CPU CFS quota",
|
||||
Value: -1,
|
||||
}, cli.Uint64Flag{
|
||||
Name: "cpu-period",
|
||||
Usage: "Limit CPU CFS period",
|
||||
})
|
||||
}
|
||||
|
@ -192,6 +192,15 @@ func NewContainer(ctx gocontext.Context, client *containerd.Client, context *cli
|
||||
opts = append(opts, oci.WithCPUCFS(quota, period))
|
||||
}
|
||||
|
||||
quota := context.Int64("cpu-quota")
|
||||
period := context.Uint64("cpu-period")
|
||||
if quota != -1 || period != 0 {
|
||||
if cpus := context.Float64("cpus"); cpus > 0.0 {
|
||||
return nil, errors.New("cpus and quota/period should be used separately")
|
||||
}
|
||||
opts = append(opts, oci.WithCPUCFS(quota, period))
|
||||
}
|
||||
|
||||
joinNs := context.StringSlice("with-ns")
|
||||
for _, ns := range joinNs {
|
||||
parts := strings.Split(ns, ":")
|
||||
|
Loading…
Reference in New Issue
Block a user