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 <nsoffer(a)redhat.com>
Reviewed-on:
http://gerrit.ovirt.org/29007
Reviewed-by: Yoav Kleinberger <ykleinbe(a)redhat.com>
Reviewed-by: Allon Mureinik <amureini(a)redhat.com>
Reviewed-by: Federico Simoncelli <fsimonce(a)redhat.com>
---
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 <nsoffer(a)redhat.com>
Gerrit-Reviewer: Allon Mureinik <amureini(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Federico Simoncelli <fsimonce(a)redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer(a)redhat.com>
Gerrit-Reviewer: Xavi Francisco <xfrancis(a)redhat.com>
Gerrit-Reviewer: Yoav Kleinberger <ykleinbe(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server