Bug check for scheduler support before setting
RHEL7 worker nodes do not support bfq. Rather than assuming the block
device supports bfq, this checks before applying the setting.
@@ -35,9 +35,20 @@ func setRootDeviceSchedulerBFQ() error {
return err
}
schedulerContents := string(schedulerContentsBuf)
- if strings.Contains(schedulerContents, fmt.Sprintf("[%s]", sched)) {
+ schedSupported := false
+ for _, v := range strings.Split(schedulerContents, " ") {
+ switch v {
+ case fmt.Sprintf("[%s]", sched):
glog.Infof("Device %s already uses scheduler %s", rootDevSysfs, sched)
return nil
+ case sched:
+ schedSupported = true
+ break
+ }
+ }
+ if !schedSupported {
+ glog.Infof("Device %s does not support the %s scheduler", rootDevSysfs, sched)
+ return nil
}
f, err := os.OpenFile(schedulerPath, os.O_WRONLY|os.O_TRUNC, 0644)
