diff --git a/watcher/decision_engine/scope/compute.py b/watcher/decision_engine/scope/compute.py index bfe0b729e..18fcb8a73 100644 --- a/watcher/decision_engine/scope/compute.py +++ b/watcher/decision_engine/scope/compute.py @@ -154,12 +154,16 @@ class ComputeScope(base.BaseScope): nodes_to_remove = set() instances_to_exclude = [] instance_metadata = [] + compute_scope = [] model_hosts = list(cluster_model.get_all_compute_nodes().keys()) - if not self.scope: + for scope in self.scope: + compute_scope = scope.get('compute') + + if not compute_scope: return cluster_model - for rule in self.scope: + for rule in compute_scope: if 'host_aggregates' in rule: self._collect_aggregates(rule['host_aggregates'], allowed_nodes) diff --git a/watcher/tests/decision_engine/scope/fake_scopes.py b/watcher/tests/decision_engine/scope/fake_scopes.py index 00c5e87ed..aab3cba8d 100644 --- a/watcher/tests/decision_engine/scope/fake_scopes.py +++ b/watcher/tests/decision_engine/scope/fake_scopes.py @@ -14,10 +14,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -fake_scope_1 = [{'availability_zones': [{'name': 'AZ1'}]}, - {'exclude': - [{'instances': - [{'uuid': 'INSTANCE_6'}]}] +fake_scope_1 = [{'compute': [{'availability_zones': [{'name': 'AZ1'}]}, + {'exclude': [ + {'instances': [ + {'uuid': 'INSTANCE_6'}]}, + ]}] } ]