From 589b90ee78bd445298110a4c24c80d5ae6ae8d85 Mon Sep 17 00:00:00 2001 From: Jan Vcelak Date: Tue, 22 Jan 2013 18:31:00 +0100 Subject: [PATCH] plugin base: add _devices_supported() method --- tuned/plugins/base.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tuned/plugins/base.py b/tuned/plugins/base.py index b347893..c57851f 100644 --- a/tuned/plugins/base.py +++ b/tuned/plugins/base.py @@ -126,9 +126,11 @@ class Plugin(object): self._assigned_devices = set() self._free_devices = set() + def _devices_supported(self): + return self._devices is not None + def _assign_free_devices_to_instance(self, instance): - # devices are not supported - if self._devices is None: + if not self._devices_supported(): return assert(isinstance(self._devices, set)) @@ -155,8 +157,7 @@ class Plugin(object): self._assign_free_devices_to_instance(self._instances[instance]) def release_devices(self, instance): - # devices are not supported - if self._devices is None: + if not self._devices_supported(): return to_release = instance.devices & self._devices