Beispiel #1
0
	def __test_tuning_plugin(self, name, load):

		log.test("tuning plugin: %s" % name)
		log.indent()

		# initialization

		log.test("initialization")
		try:
			exec "from %s.%s import _plugin" % (self.tp_dir, name)
		except Exception as e:
			log.result_e()
			log.unindent()
			return False
		log.result()

		# init()

		log.test("call init()")
		try:
			_plugin.init(self.config)
		except Exception as e:
			log.result_e(e)
			log.unindent()
			return False
		log.result()

		# setTuning()

		log.test("call setTuning()")

		if load == None:
			log.info("no data from monitor plugin available")
		else:
			try:
				_plugin.setTuning(load)
			except Exception as e:
				log.result_e(e)
				log.unindent()
				return False
			log.result()

		# cleanup()

		log.test("call cleanup()")
		try:
			_plugin.cleanup()
		except Exception as e:
			log.result_e(e)
			log.unindent()
			return False
		log.result()

		log.unindent()
		return True
Beispiel #2
0
	def __test_monitor_plugin(self, name):

		log.test("monitor plugin: %s" % name)
		log.indent()

		# initialization

		log.test("initialization")
		try:
			exec "from %s.%s import _plugin" % (self.mp_dir, name)
		except Exception as e:
			log.result_e(e)
			log.unindent()
			return None

		log.result()

		# init()

		log.test("call init()")
		try:
			_plugin.init(self.config)
		except Exception as e:
			log.result_e(e)
			log.unindent()
			return None
		log.result()

		# getLoad()

		log.test("call getLoad()")
		try:
			load = _plugin.getLoad()
			if load == None:
				raise Exception("Plugin returned None as a result.")
		except Exception as e:
			log.result_e(e)
			log.unindent()
			return None
		log.result()

		# cleanup()

		log.test("call cleanup()")
		try:
			_plugin.cleanup()
		except Exception as e:
			log.result_e(e)
			log.unindent()
			return load

		log.result()

		log.unindent()
		return load