summaryrefslogtreecommitdiff
path: root/libvirtaio.py
diff options
context:
space:
mode:
authorWojtek Porczyk <woju@invisiblethingslab.com>2017-08-31 21:20:40 +0200
committerDaniel P. Berrange <berrange@redhat.com>2017-09-26 11:01:33 +0100
commita5cc6da2c8d54f42416860f36abba629f648b228 (patch)
treefd5ac9e8b1ed84110f9c85a784cc601593f42c7a /libvirtaio.py
parentf7e5a9a085b1ed4dd72a38c787ade4a3a893463e (diff)
downloadlibvirt-python-a5cc6da2c8d54f42416860f36abba629f648b228.tar.gz
libvirtaio: cache the list of callbacks when calling
When the callback causes something that results in changes wrt registered handles, python aborts iteration. Relevant error message: Exception in callback None() handle: <Handle cancelled> Traceback (most recent call last): File "/usr/lib64/python3.5/asyncio/events.py", line 126, in _run self._callback(*self._args) File "/usr/lib64/python3.5/site-packages/libvirtaio.py", line 99, in _handle for callback in self.callbacks.values(): RuntimeError: dictionary changed size during iteration QubesOS/qubes-issues#2805 Signed-off-by: Wojtek Porczyk <woju@invisiblethingslab.com>
Diffstat (limited to 'libvirtaio.py')
-rw-r--r--libvirtaio.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/libvirtaio.py b/libvirtaio.py
index 46de9ab..d962e64 100644
--- a/libvirtaio.py
+++ b/libvirtaio.py
@@ -96,7 +96,7 @@ class Descriptor(object):
:param int event: The event (from libvirt's constants) being dispatched
'''
- for callback in self.callbacks.values():
+ for callback in list(self.callbacks.values()):
if callback.event is not None and callback.event & event:
callback.cb(callback.iden, self.fd, event, callback.opaque)