From: Ondrej Lichtner <olichtne(a)redhat.com>
The controller would crash if there was a non-xml file in a pool
directory, for example hidden .swp files created by vim. This patch
fixes that by ignoring all non-xml files.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
lnst/Controller/SlavePool.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lnst/Controller/SlavePool.py b/lnst/Controller/SlavePool.py
index 00ee4b8..0049519 100644
--- a/lnst/Controller/SlavePool.py
+++ b/lnst/Controller/SlavePool.py
@@ -52,7 +52,9 @@ class SlavePool:
res = []
for dirent in dentries:
- res.append(self.add_file("%s/%s" % (pool_dir, dirent)))
+ m_info = self.add_file("%s/%s" % (pool_dir, dirent))
+ if m_info != None:
+ res.append(m_info)
if len(res) == 0:
logging.warn("No machines found in this directory")
--
1.9.3
Show replies by thread
From: Ondrej Lichtner <olichtne(a)redhat.com>
This patch makes it possible to match hosts that have connections not
connected to the rest of the hosts. This also allows for single machine
recipes and isolated (in the context of the recipe) machines.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
lnst/Controller/SlavePool.py | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/lnst/Controller/SlavePool.py b/lnst/Controller/SlavePool.py
index 0049519..baca1e7 100644
--- a/lnst/Controller/SlavePool.py
+++ b/lnst/Controller/SlavePool.py
@@ -400,9 +400,10 @@ class SetupMapper:
topology[m_id].append(nc)
if not net_in_use:
- msg = "Network labeled '%s' contains only one
machine!" %\
- net_name
- raise MapperError(msg)
+ for dev_in_net in devs_in_net:
+ nc = (None, net_name, dev_in_net)
+ if not nc in topology[m_id]:
+ topology[m_id].append(nc)
return topology
@@ -430,6 +431,11 @@ class SetupMapper:
:rtype: Bool
"""
+ if template_id == None and pool_id == None:
+ return True
+ if template_id == None or pool_id == None:
+ return False
+
template_machine = self._template_machines[template_id]
pool_machine = self._pool_machines[pool_id]
@@ -507,7 +513,7 @@ class SetupMapper:
@staticmethod
def _get_node_with_most_neighbours(topology):
max_machine = None
- max_len = 0
+ max_len = -1
for machine, nc_list in topology.iteritems():
if len(nc_list) > max_len:
max_machine = machine
@@ -604,7 +610,8 @@ class SetupMapper:
return (i, m, n)
def _save_nc_match(self, nc_match):
- self._machine_map |= set(nc_match[1])
+ if nc_match[1] != [(None, None)]:
+ self._machine_map |= set(nc_match[1])
self._network_map |= set(nc_match[2])
def _revert_nc_match(self, nc_match):
@@ -657,11 +664,6 @@ class SetupMapper:
template_topology = self._get_topology(template_machines)
pool_topology = self._get_topology(pool_machines)
- for m, cons in template_topology.iteritems():
- if len(cons) == 0:
- msg = "Isolated machine in template topology: '%s'" %
m
- raise MapperError(msg)
-
if self._map_setup(template_topology, pool_topology):
machine_map = [(tm, pm, self._iface_map[tm]) \
for tm, pm in self._machine_map]
--
1.9.3