Fix clustered VM migration status polling

When migrating a clustered VM, we rely on the cluster resource
group status in order to determine whether the VM was properly
migrated.

After a migration is requested, the resource group immediately
enters a 'pending' state. At the moment, the method polling the
resource group state uses a list of valid transition states,
incorrectly appending the desired state of the resource group
to this list.

This causes issues if the migration fails, as we're not going to
detect this and we'll continue polling indefinitely (unless a
timeout is passed).

This change fixes this issue by removing the desired state from
the valid transition states list.

Change-Id: Id1bdd6ccc6a2a6abc99e86ca362e03eb5adb66a2
Closes-Bug: #1628938
This commit is contained in:
Lucian Petrut 2016-09-29 16:59:09 +03:00
parent ad610bcd3b
commit d4ad19dc0f
2 changed files with 3 additions and 6 deletions

View File

@ -368,9 +368,7 @@ class ClusterUtilsTestCase(test_base.OsWinBaseTestCase):
desired_state = constants.CLUSTER_GROUP_ONLINE
valid_transition_states = [constants.CLUSTER_GROUP_PENDING]
group_states = [dict(owner_node='other node',
state=desired_state),
dict(owner_node=desired_host,
group_states = [dict(owner_node=desired_host,
state=constants.CLUSTER_GROUP_PENDING),
dict(owner_node=desired_host,
state=constants.CLUSTER_GROUP_FAILED)]
@ -394,7 +392,7 @@ class ClusterUtilsTestCase(test_base.OsWinBaseTestCase):
timeout=10)
self._clusapi.get_cluster_group_state.assert_has_calls(
[mock.call(mock.sentinel.group_handle)] * 3)
[mock.call(mock.sentinel.group_handle)] * len(group_states))
@mock.patch.object(clusterutils._utils, 'time')
def test_wait_for_clus_group_state_success(self, mock_time):

View File

@ -254,8 +254,7 @@ class ClusterUtils(baseutils.BaseUtils):
reached_desired_node = desired_node.lower() == owner_node.lower()
if not (reached_desired_state and reached_desired_node):
valid_states = [desired_state] + valid_transition_states
valid_state = group_state in valid_states
valid_state = group_state in valid_transition_states
retry_context['prevent_retry'] = not valid_state
raise exceptions.InvalidClusterGroupState(