Saggi Mizrahi has uploaded a new change for review.

Change subject: Use a copy of the domainsToUpgrade
......................................................................

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(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/00/900/1
--
To view, visit http://gerrit.ovirt.org/900
To unsubscribe, visit http://gerrit.ovirt.org/settings

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

Reply via email to