mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
connection: tick() isn't reentrant, lock it
We can get weird keyerrors sometimes, if the global tick thread is scheduled off while a synchronous tick call is run (like after we create a vm). Eventually we will do away with manual tick() invocations but this will do for now.
This commit is contained in:
parent
f1207cef7b
commit
006ba306f7
@ -94,6 +94,7 @@ class vmmConnection(vmmGObject):
|
|||||||
self.state = self.STATE_DISCONNECTED
|
self.state = self.STATE_DISCONNECTED
|
||||||
self.connectThread = None
|
self.connectThread = None
|
||||||
self.connectError = None
|
self.connectError = None
|
||||||
|
self._ticklock = threading.Lock()
|
||||||
self.vmm = None
|
self.vmm = None
|
||||||
|
|
||||||
self._caps = None
|
self._caps = None
|
||||||
@ -1462,6 +1463,13 @@ class vmmConnection(vmmGObject):
|
|||||||
return (new, origlist, current)
|
return (new, origlist, current)
|
||||||
|
|
||||||
def tick(self, noStatsUpdate=False):
|
def tick(self, noStatsUpdate=False):
|
||||||
|
try:
|
||||||
|
self._ticklock.acquire()
|
||||||
|
self._tick(noStatsUpdate)
|
||||||
|
finally:
|
||||||
|
self._ticklock.release()
|
||||||
|
|
||||||
|
def _tick(self, noStatsUpdate=False):
|
||||||
""" main update function: polls for new objects, updates stats, ..."""
|
""" main update function: polls for new objects, updates stats, ..."""
|
||||||
if self.state != self.STATE_ACTIVE:
|
if self.state != self.STATE_ACTIVE:
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user