From c5d4f9cb402aa3c510b21ea00310950147c999fa Mon Sep 17 00:00:00 2001 From: David TARDIVEL Date: Tue, 24 Jan 2017 15:21:00 +0100 Subject: [PATCH] Fix building of model with a scoped exclusion rule If we define an audit scope with a exclusion rule composed with compute nodes, the compute model built is empty. I fix the algo used to built this scoped compute model. Change-Id: I675226c58474b7ea52b3f92e7b466adae40643b8 Closes-bug: #1658995 --- watcher/decision_engine/scope/default.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/watcher/decision_engine/scope/default.py b/watcher/decision_engine/scope/default.py index f9c64fd56..64abc9412 100644 --- a/watcher/decision_engine/scope/default.py +++ b/watcher/decision_engine/scope/default.py @@ -191,6 +191,7 @@ class DefaultScope(base.BaseScope): allowed_nodes = [] nodes_to_exclude = [] + nodes_to_remove = set() instances_to_exclude = [] model_hosts = list(cluster_model.get_all_compute_nodes().keys()) @@ -210,7 +211,8 @@ class DefaultScope(base.BaseScope): nodes=nodes_to_exclude) instances_to_remove = set(instances_to_exclude) - nodes_to_remove = set(model_hosts) - set(allowed_nodes) + if allowed_nodes: + nodes_to_remove = set(model_hosts) - set(allowed_nodes) nodes_to_remove.update(nodes_to_exclude) self._remove_node_from_model(nodes_to_remove, cluster_model)