mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 14:13:58 +08:00
Merge pull request #4829 from marquiz/devel/rdt-validate
libcontainer/configs/validate: check that intelrdt is enabled
This commit is contained in:
@@ -283,6 +283,10 @@ func sysctl(config *configs.Config) error {
|
||||
|
||||
func intelrdtCheck(config *configs.Config) error {
|
||||
if config.IntelRdt != nil {
|
||||
if !intelrdt.IsEnabled() {
|
||||
return fmt.Errorf("intelRdt is specified in config, but Intel RDT is not enabled")
|
||||
}
|
||||
|
||||
if config.IntelRdt.ClosID == "." || config.IntelRdt.ClosID == ".." || strings.Contains(config.IntelRdt.ClosID, "/") {
|
||||
return fmt.Errorf("invalid intelRdt.ClosID %q", config.IntelRdt.ClosID)
|
||||
}
|
||||
|
||||
@@ -416,6 +416,12 @@ func WriteIntelRdtTasks(dir string, pid int) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// IsEnabled checks if Intel RDT is enabled.
|
||||
func IsEnabled() bool {
|
||||
fsroot, err := Root()
|
||||
return err == nil && fsroot != ""
|
||||
}
|
||||
|
||||
// IsCATEnabled checks if Intel RDT/CAT is enabled.
|
||||
func IsCATEnabled() bool {
|
||||
featuresInit()
|
||||
|
||||
Reference in New Issue
Block a user