Exemple #1
0
    def __init__(self, fan_name, pTable):
        try:
            self.fan_num = int(fan_name)
            if 'label' in pTable:
                self.label = pTable['label']
            else:
                self.label = "Fan %d" % (self.fan_num)

            if 'sysfs' in pTable['read_source']:
                if 'write_source' in pTable:
                    self.source = FscSensorSourceSysfs(
                        name=fan_name,
                        read_source=pTable['read_source']['sysfs'],
                        write_source=pTable['write_source']['sysfs'])
                else:
                    self.source = FscSensorSourceSysfs(
                        name=fan_name,
                        read_source=pTable['read_source']['sysfs'])
            if 'util' in pTable['read_source']:
                if 'write_source' in pTable:
                    self.source = FscSensorSourceUtil(
                        name=fan_name,
                        read_source=pTable['read_source']['util'],
                        write_source=pTable['write_source']['util'])
                else:
                    self.source = FscSensorSourceUtil(
                        name=fan_name,
                        read_source=pTable['read_source']['util'])
        except Exception:
            Logger.error("Unknown Fan source type")
    def __init__(self, fan_name, pTable):
        try:
            self.fan_num = int(fan_name)
            if "label" in pTable:
                self.label = pTable["label"]
            else:
                self.label = "Fan %d" % (self.fan_num)

            if "sysfs" in pTable["read_source"]:
                if "write_source" in pTable:
                    self.source = FscSensorSourceSysfs(
                        name=fan_name,
                        read_source=pTable["read_source"]["sysfs"],
                        write_source=pTable["write_source"]["sysfs"],
                    )
                else:
                    self.source = FscSensorSourceSysfs(
                        name=fan_name,
                        read_source=pTable["read_source"]["sysfs"])
            if "util" in pTable["read_source"]:
                if "write_source" in pTable:
                    self.source = FscSensorSourceUtil(
                        name=fan_name,
                        read_source=pTable["read_source"]["util"],
                        write_source=pTable["write_source"]["util"],
                    )
                else:
                    self.source = FscSensorSourceUtil(
                        name=fan_name,
                        read_source=pTable["read_source"]["util"])
        except Exception:
            Logger.error("Unknown Fan source type")
Exemple #3
0
def stop_watchdog():
    """kick the watchdog device.
    """
    f = subprocess.Popen(WDTCLI_CMD + ' stop',
                         shell=True,
                         stdout=subprocess.PIPE,
                         stderr=subprocess.PIPE)
    info, err = f.communicate()
    if len(err) != 0:
        Logger.error("failed to kick watchdog device")
Exemple #4
0
def stop_watchdog():
    """kick the watchdog device.
    """
    f = subprocess.Popen(WDTCLI_CMD + " stop",
                         shell=True,
                         stdout=subprocess.PIPE,
                         stderr=subprocess.PIPE)
    info, err = f.communicate()
    if len(err) != 0:
        Logger.error("failed to stop watchdog device")
    else:
        Logger.info("watchdog stopped")
 def __init__(self, sensor_name, pTable):
     try:
         if "read_source" in pTable:
             if "sysfs" in pTable["read_source"]:
                 self.source = FscSensorSourceSysfs(
                     name=sensor_name,
                     read_source=pTable["read_source"]["sysfs"])
             if "util" in pTable["read_source"]:
                 self.source = FscSensorSourceUtil(
                     name=sensor_name,
                     read_source=pTable["read_source"]["util"])
     except Exception:
         Logger.error("Unknown Sensor source type")
def make_controller(pTable):
    if pTable['type'] == 'linear':
        controller = TTable(pTable['data'], pTable.get('negative_hysteresis',
                                                       0),
                            pTable.get('positive_hysteresis', 0))
        return controller
    if pTable['type'] == 'pid':
        controller = PID(pTable['setpoint'], pTable['kp'], pTable['ki'],
                         pTable['kd'], pTable['negative_hysteresis'],
                         pTable['positive_hysteresis'])
        return controller
    err = "Don't understand profile type '%s'" % (pTable['type'])
    Logger.error(err)
 def __init__(self, sensor_name, pTable):
     try:
         if 'read_source' in pTable:
             if 'sysfs' in pTable['read_source']:
                 self.source = FscSensorSourceSysfs(
                     name=sensor_name,
                     read_source=pTable['read_source']['sysfs'])
             if 'util' in pTable['read_source']:
                 self.source = FscSensorSourceUtil(
                     name=sensor_name,
                     read_source=pTable['read_source']['util'])
     except Exception:
         Logger.error("Unknown Sensor source type")
Exemple #8
0
    def get_config_params(self):
        self.transitional = self.fsc_config['pwm_transition_value']
        self.boost = self.fsc_config['pwm_boost_value']
        if 'boost' in self.fsc_config and 'fan_fail' in self.fsc_config[
                'boost']:
            self.fan_fail = self.fsc_config['boost']['fan_fail']
        if 'boost' in self.fsc_config and 'progressive' in self.fsc_config[
                'boost']:
            if self.fsc_config['boost']['progressive']:
                self.boost_type = 'progressive'
            if 'fan_dead_boost' in self.fsc_config:
                self.fan_dead_boost = self.fsc_config['fan_dead_boost']
        if 'boost' in self.fsc_config and 'sensor_fail' in self.fsc_config[
                'boost']:
            if self.fsc_config['boost']['sensor_fail']:
                if 'fail_sensor_type' in self.fsc_config:
                    self.fail_sensor_type = self.fsc_config['fail_sensor_type']
                if 'ssd_progressive_algorithm' in self.fsc_config:
                    self.ssd_progressive_algorithm = self.fsc_config[
                        'ssd_progressive_algorithm']

        self.watchdog = self.fsc_config['watchdog']
        if 'fanpower' in self.fsc_config:
            self.fanpower = self.fsc_config['fanpower']
        else:
            self.fanpower = False
        if 'chassis_intrusion' in self.fsc_config:
            self.chassis_intrusion = self.fsc_config['chassis_intrusion']
        else:
            self.chassis_intrusion = False
        if 'ramp_rate' in self.fsc_config:
            self.ramp_rate = self.fsc_config['ramp_rate']
        self.wdfile = None
        if self.watchdog:
            Logger.info("watchdog pinging enabled")
            self.wdfile = open('/dev/watchdog', 'w+')
            if not self.wdfile:
                Logger.error("couldn't open watchdog device")
            else:
                self.wdfile.write('V')
                self.wdfile.flush()
        self.interval = self.fsc_config['sample_interval_ms'] / 1000.0
def make_controller(pTable):
    if pTable["type"] == "linear":
        controller = TTable(
            pTable["data"],
            pTable.get("negative_hysteresis", 0),
            pTable.get("positive_hysteresis", 0),
        )
        return controller
    if pTable["type"] == "pid":
        controller = PID(
            pTable["setpoint"],
            pTable["kp"],
            pTable["ki"],
            pTable["kd"],
            pTable["negative_hysteresis"],
            pTable["positive_hysteresis"],
        )
        return controller
    err = "Don't understand profile type '%s'" % (pTable["type"])
    Logger.error(err)
Exemple #10
0
def make_controller(pTable):
    if pTable["type"] == "linear":
        controller = TTable(
            pTable["data"],
            pTable.get("negative_hysteresis", 0),
            pTable.get("positive_hysteresis", 0),
        )
        return controller
    if pTable["type"] == "pid":
        controller = PID(
            pTable["setpoint"],
            pTable["kp"],
            pTable["ki"],
            pTable["kd"],
            pTable["negative_hysteresis"],
            pTable["positive_hysteresis"],
        )
        return controller
    if pTable["type"] == "linear_4curve":
        controller = TTable4Curve(
            pTable["data_normal_up"],
            pTable["data_normal_down"],
            pTable["data_onefail_up"],
            pTable["data_onefail_down"],
        )
        return controller
    if pTable["type"] == "incrementpid":
        controller = IncrementPID(
            pTable["setpoint"],
            pTable["kp"],
            pTable["ki"],
            pTable["kd"],
            pTable["negative_hysteresis"],
            pTable["positive_hysteresis"],
        )
        return controller
    err = "Don't understand profile type '%s'" % (pTable["type"])
    Logger.error(err)