Fix 'unable to exclude instance'

Change-Id: I1599a86a2ba7d3af755fb1412a5e38516c736957
Closes-Bug: #1736129
This commit is contained in:
aditi
2017-12-08 11:48:27 +05:30
committed by aditi
parent c2e16bfa96
commit be56441e55
2 changed files with 11 additions and 6 deletions

View File

@@ -147,12 +147,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)

View File

@@ -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'}]},
]}]
}
]