Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cgroup controller detection tweaks #441

Merged
merged 4 commits into from
Jan 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/requirements.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ The following optional features also require extra kernel options:

* Namespaces (`user` and `cgroup`)
* AppArmor (including Ubuntu patch for mount mediation)
* Control Groups (`blkio`, `cpuset`, `devices`, `memory`, `pids` and `net_prio`)
* Control Groups (`blkio`, `cpuset`, `devices`, `memory` and `pids`)
* CRIU (exact details to be found with CRIU upstream)

As well as any other kernel feature required by the LXC version in use.
Expand Down
15 changes: 0 additions & 15 deletions internal/server/cgroup/abstraction.go
Original file line number Diff line number Diff line change
Expand Up @@ -747,21 +747,6 @@ func (cg *CGroup) SetCPUCfsLimit(limitPeriod int64, limitQuota int64) error {
return ErrUnknownVersion
}

// SetNetIfPrio sets the priority for the process.
func (cg *CGroup) SetNetIfPrio(limit string) error {
version := cgControllers["net_prio"]
switch version {
case Unavailable:
return ErrControllerMissing
case V1:
return cg.rw.Set(version, "net_prio", "net_prio.ifpriomap", limit)
case V2:
return ErrControllerMissing
}

return ErrUnknownVersion
}

// SetHugepagesLimit applies a limit to the number of processes.
func (cg *CGroup) SetHugepagesLimit(pageType string, limit int64) error {
version := cgControllers["hugetlb"]
Expand Down
18 changes: 2 additions & 16 deletions internal/server/cgroup/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,6 @@ const (
// MemorySwappiness resource control.
MemorySwappiness

// NetPrio resource control.
NetPrio

// Pids resource control.
Pids
)
Expand Down Expand Up @@ -218,9 +215,6 @@ func (info *Info) SupportsVersion(resource Resource) (Backend, bool) {
}

return Unavailable, false
case NetPrio:
val, ok := cgControllers["net_prio"]
return val, ok
case Pids:
val, ok := cgControllers["pids"]
if ok {
Expand Down Expand Up @@ -310,13 +304,6 @@ func (info *Info) Warnings() []cluster.Warning {
})
}

if !info.Supports(NetPrio, nil) {
warnings = append(warnings, cluster.Warning{
TypeCode: warningtype.MissingCGroupNetworkPriorityController,
LastMessage: "per-instance network priority will be ignored. Please use per-device limits.priority instead",
})
}

if !info.Supports(Pids, nil) {
warnings = append(warnings, cluster.Warning{
TypeCode: warningtype.MissingCGroupPidsController,
Expand Down Expand Up @@ -378,8 +365,7 @@ func Init() {
}

// Parse V2 controllers.
path := fields[2]
hybridPath := filepath.Join(cgPath, "unified", path, "cgroup.controllers")
hybridPath := filepath.Join(cgPath, "unified", "cgroup.controllers")
dedicatedPath := ""

controllers, err := os.Open(hybridPath)
Expand All @@ -389,7 +375,7 @@ func Init() {
return
}

dedicatedPath = filepath.Join(cgPath, path, "cgroup.controllers")
dedicatedPath = filepath.Join(cgPath, "cgroup.controllers")
controllers, err = os.Open(dedicatedPath)
if err != nil && !os.IsNotExist(err) {
logger.Errorf("Unable to load cgroup.controllers")
Expand Down
7 changes: 2 additions & 5 deletions internal/server/db/warningtype/warning_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ const (
MissingCGroupHugetlbController
// MissingCGroupMemoryController represents the missing GCgroup memory controller warning.
MissingCGroupMemoryController
// MissingCGroupNetworkPriorityController represents the missing GCgroup network priority controller warning.
MissingCGroupNetworkPriorityController
// Spacer where MissingCGroupNetworkPriorityController used to be.
_
// MissingCGroupPidsController represents the missing GCgroup pids controller warning.
MissingCGroupPidsController
// MissingCGroupMemorySwapAccounting represents the missing GCgroup memory swap accounting warning.
Expand Down Expand Up @@ -70,7 +70,6 @@ var TypeNames = map[Type]string{
MissingCGroupFreezerController: "Couldn't find the CGroup freezer controller",
MissingCGroupHugetlbController: "Couldn't find the CGroup hugetlb controller",
MissingCGroupMemoryController: "Couldn't find the CGroup memory controller",
MissingCGroupNetworkPriorityController: "Couldn't find the CGroup network priority controller",
MissingCGroupPidsController: "Couldn't find the CGroup pids controller",
MissingCGroupMemorySwapAccounting: "Couldn't find the CGroup memory swap accounting",
ClusterTimeSkew: "Time skew detected between leader and local",
Expand Down Expand Up @@ -110,8 +109,6 @@ func (t Type) Severity() Severity {
return SeverityLow
case MissingCGroupMemoryController:
return SeverityLow
case MissingCGroupNetworkPriorityController:
return SeverityLow
case MissingCGroupPidsController:
return SeverityLow
case MissingCGroupMemorySwapAccounting:
Expand Down
Loading