commit f9c2503609bfad0b871d9e87227aa2bb5c137467
Author: Matthew Booth <email address hidden>
Date: Mon May 13 16:04:39 2019 +0100
Fix retry of instance_update_and_get_original
_instance_update modifies its 'values' argument. Consequently if it is
retried due to an update conflict, the second invocation has the wrong
arguments.
A specific issue this causes is that if we called it with
expected_task_state a concurrent modification to task_state will cause
us to fail and retry. However, expected_task_state will have been popped
from values on the first invocation and will not be present for the
second. Consequently the second invocation will fail to perform the
task_state check and therefore succeed, resulting in a race.
We rewrite the old race unit test which wasn't testing the correct
thing for 2 reasons:
1. Due to the bug fixed in this patch, although we were calling update_on_match() twice, the second call didn't check the task state.
2. side_effect=iterable returns function items without executing them,
but we weren't hitting this due to the bug fixed in this patch.
Closes-Bug: #1821373
Change-Id: I01c63e685113bf30e687ccb14a4d18e344b306f6
(cherry picked from commit aae5c7aa3819ad9161fd2effed3872d540099230)
(cherry picked from commit 61fef49b1555c6509398fc47c21319c1b5e50505)
(cherry picked from commit 4540cd6ef9731837cf4ed1e56850bcfa3512ae1c)
Reviewed: https:/ /review. opendev. org/659320 /git.openstack. org/cgit/ openstack/ nova/commit/ ?id=f9c2503609b fad0b871d9e8722 7aa2bb5c137467
Committed: https:/
Submitter: Zuul
Branch: stable/queens
commit f9c2503609bfad0 b871d9e87227aa2 bb5c137467
Author: Matthew Booth <email address hidden>
Date: Mon May 13 16:04:39 2019 +0100
Fix retry of instance_ update_ and_get_ original
_instance_ update modifies its 'values' argument. Consequently if it is
retried due to an update conflict, the second invocation has the wrong
arguments.
A specific issue this causes is that if we called it with task_state a concurrent modification to task_state will cause
expected_
us to fail and retry. However, expected_task_state will have been popped
from values on the first invocation and will not be present for the
second. Consequently the second invocation will fail to perform the
task_state check and therefore succeed, resulting in a race.
We rewrite the old race unit test which wasn't testing the correct
thing for 2 reasons:
1. Due to the bug fixed in this patch, although we were calling
update_ on_match( ) twice, the second call didn't check the task state. iterable returns function items without executing them,
2. side_effect=
but we weren't hitting this due to the bug fixed in this patch.
Closes-Bug: #1821373 30e687ccb14a4d1 8e344b306f6 161fd2effed3872 d540099230) 09398fc47c21319 c1b5e50505) 7cf4ed1e56850bc fa3512ae1c)
Change-Id: I01c63e685113bf
(cherry picked from commit aae5c7aa3819ad9
(cherry picked from commit 61fef49b1555c65
(cherry picked from commit 4540cd6ef973183