mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
libcontainer/configs/validate: use early return
...in intelrdtCheck, like all other checks already do. Best reviewed with --ignore-all-space. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
@@ -306,22 +306,23 @@ 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 == nil {
|
||||
return nil
|
||||
}
|
||||
if !intelRdt.isEnabled() {
|
||||
return fmt.Errorf("intelRdt is specified in config, but Intel RDT is not enabled")
|
||||
}
|
||||
|
||||
switch clos := config.IntelRdt.ClosID; {
|
||||
case clos == ".", clos == "..", len(clos) > 1 && strings.Contains(clos, "/"):
|
||||
return fmt.Errorf("invalid intelRdt.ClosID %q", clos)
|
||||
}
|
||||
switch clos := config.IntelRdt.ClosID; {
|
||||
case clos == ".", clos == "..", len(clos) > 1 && strings.Contains(clos, "/"):
|
||||
return fmt.Errorf("invalid intelRdt.ClosID %q", clos)
|
||||
}
|
||||
|
||||
if !intelRdt.isCATEnabled() && config.IntelRdt.L3CacheSchema != "" {
|
||||
return errors.New("intelRdt.l3CacheSchema is specified in config, but Intel RDT/CAT is not enabled")
|
||||
}
|
||||
if !intelRdt.isMBAEnabled() && config.IntelRdt.MemBwSchema != "" {
|
||||
return errors.New("intelRdt.memBwSchema is specified in config, but Intel RDT/MBA is not enabled")
|
||||
}
|
||||
if !intelRdt.isCATEnabled() && config.IntelRdt.L3CacheSchema != "" {
|
||||
return errors.New("intelRdt.l3CacheSchema is specified in config, but Intel RDT/CAT is not enabled")
|
||||
}
|
||||
if !intelRdt.isMBAEnabled() && config.IntelRdt.MemBwSchema != "" {
|
||||
return errors.New("intelRdt.memBwSchema is specified in config, but Intel RDT/MBA is not enabled")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user