Add support for defining specific threads for containers
This commit is contained in:
parent
f0e37f1e98
commit
ddca34f9e8
|
@ -40,6 +40,7 @@ func New(data []byte) (*Installer, error) {
|
||||||
IoWeight: uint16(getInt(data, "build", "io")),
|
IoWeight: uint16(getInt(data, "build", "io")),
|
||||||
CpuLimit: getInt(data, "build", "cpu"),
|
CpuLimit: getInt(data, "build", "cpu"),
|
||||||
DiskSpace: getInt(data, "build", "disk"),
|
DiskSpace: getInt(data, "build", "disk"),
|
||||||
|
Threads: getString(data, "build", "threads"),
|
||||||
},
|
},
|
||||||
Allocations: server.Allocations{
|
Allocations: server.Allocations{
|
||||||
Mappings: make(map[string][]int),
|
Mappings: make(map[string][]int),
|
||||||
|
@ -115,7 +116,6 @@ func (i *Installer) Execute() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
zap.S().Debugw("creating required environment for server instance", zap.String("server", i.Uuid()))
|
zap.S().Debugw("creating required environment for server instance", zap.String("server", i.Uuid()))
|
||||||
if err := i.server.Environment.Create(); err != nil {
|
if err := i.server.Environment.Create(); err != nil {
|
||||||
zap.S().Errorw("failed to create environment for server", zap.String("server", i.Uuid()), zap.Error(err))
|
zap.S().Errorw("failed to create environment for server", zap.String("server", i.Uuid()), zap.Error(err))
|
||||||
|
|
|
@ -817,5 +817,6 @@ func (d *DockerEnvironment) getResourcesForServer() container.Resources {
|
||||||
CPUShares: 1024,
|
CPUShares: 1024,
|
||||||
BlkioWeight: d.Server.Build.IoWeight,
|
BlkioWeight: d.Server.Build.IoWeight,
|
||||||
OomKillDisable: &d.Server.Container.OomDisabled,
|
OomKillDisable: &d.Server.Container.OomDisabled,
|
||||||
|
CpusetCpus: d.Server.Build.Threads,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,6 +98,9 @@ type BuildSettings struct {
|
||||||
|
|
||||||
// The amount of disk space in megabytes that a server is allowed to use.
|
// The amount of disk space in megabytes that a server is allowed to use.
|
||||||
DiskSpace int64 `json:"disk_space" yaml:"disk"`
|
DiskSpace int64 `json:"disk_space" yaml:"disk"`
|
||||||
|
|
||||||
|
// Sets which CPU threads can be used by the docker instance.
|
||||||
|
Threads string `json:"threads" yaml:"threads"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Converts the CPU limit for a server build into a number that can be better understood
|
// Converts the CPU limit for a server build into a number that can be better understood
|
||||||
|
@ -294,7 +297,7 @@ func (s *Server) Sync() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the data structure and persist it to the disk.
|
// Update the data structure and persist it to the disk.
|
||||||
if err:= s.UpdateDataStructure(cfg.Settings, false); err != nil {
|
if err := s.UpdateDataStructure(cfg.Settings, false); err != nil {
|
||||||
return errors.WithStack(err)
|
return errors.WithStack(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user