Example #1
0
File: net.py Project: hanzz/tuned
	def setTuning(self, load):
		if not self.enabled:
			return
		ethcards = load.setdefault("NET", {})
		for dev in ethcards.keys():
			devload = ethcards[dev]
			self._updateIdle(dev, devload)
			if self.devidle[dev]["LEVEL"] == 0 and self.devidle[dev]["READ"] >= 6 and self.devidle[dev]["WRITE"] >= 6:
				self.devidle[dev]["LEVEL"] = 1

				log.debug("%s: setting 100Mbps" % dev)
				ethcard(dev).set_speed(100)
			if self.devidle[dev]["LEVEL"] > 0 and (self.devidle[dev]["READ"] == 0 or self.devidle[dev]["WRITE"] == 0):
				self.devidle[dev]["LEVEL"] = 0

				log.debug("%s: setting maximal speed" % dev)
				ethcard(dev).set_max_speed()
Example #2
0
File: net.py Project: hanzz/tuned
	def __init__(self):
		self.devices = {}
		self.enabled = True
		tunable = self._tunable_devices()
		for dev in tunable:
			max_speed = self._calcspeed(ethcard(dev).get_max_speed())
			self.devices[dev] = {}
			self.devices[dev]["new"] = ['0', '0', '0', '0']
			self.devices[dev]["max"] = [max_speed, 1, max_speed, 1]
			self._updateStat(dev)
			self.devices[dev]["max"] = [max_speed, 1, max_speed, 1]
Example #3
0
File: net.py Project: hanzz/tuned
	def init(self, config):
		log.debug("Init")

		self.config = config
		if self.config.has_option(self.config_section, "enabled"):
			self.enabled = (self.config.get(self.config_section, "enabled") == "True")
		interval = self.config.getint("main", "interval")

		log.info("Module is %s" % ("enabled" if self.enabled else "disabled"))

		for d in self.devices.keys():
			max_data = self._calcspeed(ethcard(d).get_max_speed()) * interval;
			self.devices[d]["max"] = [max_data, 1, max_data, 1]

		log.info("Tunable ethernet cards: %s" % ", ".join(self.devices.keys()))
Example #4
0
File: net.py Project: hanzz/tuned
	def _device_is_tunable(self, name):
		if self._device_type(name) in "virtual":
			return False

		card = ethcard(name)
		return len(card.supported_modes) > 1 and card.get_max_speed() >= 1000
Example #5
0
File: net.py Project: hanzz/tuned
	def cleanup(self):
		log.debug("Cleanup")

		for dev in self.devidle.keys():
			if self.enabled and self.devidle[dev]["LEVEL"] > 0:
				ethcard(dev).set_max_speed()