Do not include pending deletion node in upgradable nodes

Previously pending for deletion nodes were included in deployment
if they were selected for update, by deploying other roles

You can observe one example of this behaviour in test

Closes-Bug: 1446202
Change-Id: Ic80e1421eea6a3227fc8d890bfdbab933da72fbc
This commit is contained in:
Dmitry Shulyak 2015-05-19 16:23:40 +03:00
parent 593c99f2b4
commit ea7ea8ffff
2 changed files with 45 additions and 1 deletions

View File

@ -190,7 +190,7 @@ class TaskHelper(object):
:returns: None
"""
for node in cluster.nodes:
if (node not in nodes_to_deploy and
if (node not in nodes_to_deploy and not node.pending_deletion and
set(node.roles) & update_required):
nodes_to_deploy.append(node)

View File

@ -0,0 +1,44 @@
# -*- coding: utf-8 -*-
# Copyright 2015 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from nailgun.task.helpers import TaskHelper
from nailgun.test.base import BaseIntegrationTest
class TestDeploymentNodesFiltering(BaseIntegrationTest):
def setUp(self):
super(TestDeploymentNodesFiltering, self).setUp()
self.env.create(
release_kwargs={
'version': "2014.2-6.0"
},
nodes_kwargs=[
{'roles': ['controller'], 'status': 'ready'},
{'pending_roles': ['controller'],
'pending_addition': True},
{'roles': ['cinder'],
'pending_deletion': True,
'status': 'ready'}
]
)
def test_related_pending_deletion_nodes_not_present(self):
cluster = self.env.clusters[0]
controllers = [n for n in cluster.nodes if 'controller' in n.all_roles]
nodes_to_deploy = TaskHelper.nodes_to_deploy(cluster)
self.assertItemsEqual(controllers, nodes_to_deploy)