Dan Kenigsberg has submitted this change and it was merged.

Change subject: domainMonitor: Fix unsafe iteration
......................................................................


domainMonitor: Fix unsafe iteration

Using dict.iteritems() is safe only if nobody else can modify the
dictionary while iterating. However in DomainMonitor, others threads can
add or remove items during the iteration, so we must use dict.items(),
which copies the keys and values atomically.

dict.iteritems() is useful when we have huge dict and we don't want to
create a huge list of items, but in case of the domain monitor, where we
have less then 100 monitors, there is not need for fancy iteration.

While modifying this line, I also improve the names to make the code
more clear, this can be separated to another patch but I don't think it
is needed in this case.

Change-Id: I5313d25c7148e4a0362d19fe31d2e78f94c26e39
Signed-off-by: Nir Soffer <[email protected]>
Reviewed-on: http://gerrit.ovirt.org/29007
Reviewed-by: Yoav Kleinberger <[email protected]>
Reviewed-by: Allon Mureinik <[email protected]>
Reviewed-by: Federico Simoncelli <[email protected]>
---
M vdsm/storage/domainMonitor.py
1 file changed, 2 insertions(+), 1 deletion(-)

Approvals:
  Nir Soffer: Verified
  Federico Simoncelli: Looks good to me, approved
  Yoav Kleinberger: Looks good to me, but someone else must approve
  Allon Mureinik: Looks good to me, but someone else must approve



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

Gerrit-MessageType: merged
Gerrit-Change-Id: I5313d25c7148e4a0362d19fe31d2e78f94c26e39
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <[email protected]>
Gerrit-Reviewer: Allon Mureinik <[email protected]>
Gerrit-Reviewer: Dan Kenigsberg <[email protected]>
Gerrit-Reviewer: Federico Simoncelli <[email protected]>
Gerrit-Reviewer: Nir Soffer <[email protected]>
Gerrit-Reviewer: Xavi Francisco <[email protected]>
Gerrit-Reviewer: Yoav Kleinberger <[email protected]>
Gerrit-Reviewer: [email protected]
Gerrit-Reviewer: oVirt Jenkins CI Server
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to