Apply suggestions from code review

Co-authored-by: Drew Bailey <drewbailey5@gmail.com>
This commit is contained in:
Nick Ethier 2021-04-09 13:12:53 -04:00
parent 339c671e29
commit 0a21de91dd
3 changed files with 7 additions and 6 deletions

View File

@ -636,8 +636,9 @@ func (c *Client) init() error {
// Ensure cgroups are created on linux platform
if err := cgutil.InitCpusetParent(c.config.CgroupParent); err != nil {
// if the client cannot initialize the cgroup then reserved cores will not be reported and the cpuset manager
// will be disabled. this is common when running in dev mode under a non-root user for example
// If the client cannot initialize the cgroup then reserved cores will
// not be reported and the cpuset manager will be disabled. This is
// common when running in dev mode under a non-root user for example.
c.logger.Warn("could not initialize cpuset cgroup subsystem, cpuset management disabled", "error", err)
c.config.DisableCgroupManagement = true
}

View File

@ -269,10 +269,10 @@ type Config struct {
BindWildcardDefaultHostNetwork bool
// CgroupParent is the parent cgroup Nomad should use when managing any cgroup subsystems.
// Currently this only includes the 'cpuset' cgroup subsystem
// Currently this only includes the 'cpuset' cgroup subsystem.
CgroupParent string
// ReservableCores if set overrides the set of reservable cores reported in fingerprinting
// ReservableCores if set overrides the set of reservable cores reported in fingerprinting.
ReservableCores []uint16
// DisableCgroupManagement if true disables all management of cgroup subsystems by the Nomad client. It does

View File

@ -17,10 +17,10 @@ const (
SharedCpusetCgroupName = "shared"
)
// InitCpusetParent checks that the cgroup parent and expected child cgroups have been created
// InitCpusetParent checks that the cgroup parent and expected child cgroups have been created.
// If the cgroup parent is set to /nomad then this will ensure that the /nomad/shared
// cgroup is initialized. The /nomad/reserved cgroup will be lazily created when a workload
// with reserved cores is created
// with reserved cores is created.
func InitCpusetParent(cgroupParent string) error {
if cgroupParent == "" {
cgroupParent = DefaultCgroupParent