Function dev_db_get_name() is here called twice and can be reduced to
only one call. Because it queries Slave machine n times, where n is
size of device database on Slave, it can take a lot of time when
database is large.
This reduces time it takes to return from this function
to a half.
Signed-off-by: Jiri Prochazka <jprochaz(a)redhat.com>
---
lnst/Controller/Task.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lnst/Controller/Task.py b/lnst/Controller/Task.py
index 4f4a772..af1db96 100644
--- a/lnst/Controller/Task.py
+++ b/lnst/Controller/Task.py
@@ -314,7 +314,7 @@ class HostAPI(object):
def get_device(self, name):
dev = self._m.dev_db_get_name(name)
if dev:
- return DeviceAPI(self._m.dev_db_get_name(name), self)
+ return DeviceAPI(dev, self)
else:
raise TaskError("No device with name '%s' found." %
str(name))
--
2.9.3