Change in vdsm[master]: removeVmFromMonitoredDomains: Copy keys before traversing an...

zhshzhou at linux.vnet.ibm.com zhshzhou at linux.vnet.ibm.com
Mon Aug 5 10:09:21 UTC 2013


Zhou Zheng Sheng has uploaded a new change for review.

Change subject: removeVmFromMonitoredDomains: Copy keys before traversing and deleting items in domainVmIds
......................................................................

removeVmFromMonitoredDomains: Copy keys before traversing and deleting items in domainVmIds

removeVmFromMonitoredDomains delete items from the domainVmIds dict
while traversing it, this will cause exception as follow.

"RuntimeError: dictionary changed size during iteration"

This problem can be reproduced by running VDSM functional tests as
follow.

cd /usr/share/vdsm/tests
./run_tests.sh -m 'testSimpleVMWithStorage.*localfs' functional/xmlrpcTests.py

The exception is raised when vm.destroy is called.

This patch fixes the problem by traversing over the copied keys of the
original dictionary.

Change-Id: I9767dc7a723ac6c20f68c620d1bfb3292fec4792
Signed-off-by: Zhou Zheng Sheng <zhshzhou at linux.vnet.ibm.com>
---
M vdsm/clientIF.py
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/55/17655/1

diff --git a/vdsm/clientIF.py b/vdsm/clientIF.py
index c8b0ad3..cde78b6 100644
--- a/vdsm/clientIF.py
+++ b/vdsm/clientIF.py
@@ -122,7 +122,7 @@
                     self.domainVmIds[dom] = set([vmId])
 
     def removeVmFromMonitoredDomains(self, vmId):
-        for dom in self.domainVmIds:
+        for dom in list(self.domainVmIds.keys()):
             #only take lock here to allow runVm to take the lock in-between
             with self.domainVmIdsLock:
                 try:


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9767dc7a723ac6c20f68c620d1bfb3292fec4792
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Zhou Zheng Sheng <zhshzhou at linux.vnet.ibm.com>


More information about the vdsm-patches mailing list