mirror of
https://github.com/kemko/nomad.git
synced 2026-01-10 20:35:42 +03:00
Adding cpu resource limits
This commit is contained in:
committed by
Michael Schurter
parent
69b309685c
commit
340efc879d
@@ -182,6 +182,9 @@ func (d *LxcDriver) Start(ctx *ExecContext, task *structs.Task) (DriverHandle, e
|
||||
if err := c.SetMemoryLimit(lxc.ByteSize(task.Resources.MemoryMB) * lxc.MB); err != nil {
|
||||
return nil, fmt.Errorf("unable to set memory limits: %v", err)
|
||||
}
|
||||
if err := c.SetCgroupItem("cpu.shares", strconv.Itoa(task.Resources.CPU)); err != nil {
|
||||
return nil, fmt.Errorf("unable to set cpu shares: %v", err)
|
||||
}
|
||||
|
||||
handle := lxcDriverHandle{
|
||||
container: c,
|
||||
|
||||
Reference in New Issue
Block a user