Dan Kenigsberg has submitted this change and it was merged.

Change subject: BZ#771329 Use a copy of the domainsToUpgrade
......................................................................


BZ#771329 Use a copy of the domainsToUpgrade

The original code just uses another ref that is changed while iterated
which has unexpected results. This was not apparent as the remove might
happened after the iteration because it might run in another thread.

To illustrate:

In [1]: a = [1,2,3,4,5,6,7,8,9,10]

In [2]: for i in a:
...:     a.remove(i)
...:

In [3]: a
Out[3]: [2, 4, 6, 8, 10]

In [4]: for i in a:
...:     a.remove(i)
...:

In [5]: a
Out[5]: [4, 8]

In [6]: for i in a[:]:
...:     a.remove(i)
...:

In [7]: a
Out[7]: []

Fun!

Change-Id: I3de0646af2fe9a9fcde708837cfcd83d10385026
---
M vdsm/storage/sp.py
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Dan Kenigsberg: Verified; Looks good to me, approved


--
To view, visit http://gerrit.ovirt.org/900
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I3de0646af2fe9a9fcde708837cfcd83d10385026
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Saggi Mizrahi <[email protected]>
Gerrit-Reviewer: Dan Kenigsberg <[email protected]>
Gerrit-Reviewer: Saggi Mizrahi <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to