commit 10db214eba1faf3c6b9b0670922381a3249b350a
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Fri Sep 20 12:50:32 2013 +0200
SlavePool: fix object initialization
Object specific attributes have to be initialized in the constructor. If
they are initialized under the class definition, the attribute objects
will be shared between instances.
This caused a bug to appear- when running multiple recipes, if a slave
machine is available during one recipe, but becomes unavailable before
the next recipe it will still be considered during machine matching for
the next recipe.
This commit fixes that bug.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
lnst/Controller/SlavePool.py | 15 ++++++---------
1 files changed, 6 insertions(+), 9 deletions(-)
---
diff --git a/lnst/Controller/SlavePool.py b/lnst/Controller/SlavePool.py
index bd81f81..301ea60 100644
--- a/lnst/Controller/SlavePool.py
+++ b/lnst/Controller/SlavePool.py
@@ -32,19 +32,16 @@ class SlavePool:
This class is responsible for managing test machines that
are available at the controler and can be used for testing.
"""
+ def __init__(self, pool_dirs, allow_virtual=False, pool_checks=True):
+ self._map = {}
+ self._pool = {}
- _map = {}
- _pool = {}
-
- _machine_matches = []
- _network_matches = []
-
- _allow_virt = False
- _pool_checks = True
+ self._machine_matches = []
+ self._network_matches = []
- def __init__(self, pool_dirs, allow_virtual=False, pool_checks=True):
self._allow_virt = allow_virtual
self._pool_checks = pool_checks
+
logging.info("Checking machine pool availability.")
for pool_dir in pool_dirs:
self.add_dir(pool_dir)