2
0
mirror of https://github.com/xcat2/confluent.git synced 2026-09-22 09:32:28 +00:00

Give the virsh console loop a reason to wake

virEventRunDefaultImpl waits for an event that an idle domain need not
produce, so the thread could outlive a deactivation that reported success, and
every later activation was refused while it did. Registering a timeout is what
makes it return: measured, a thread with nothing registered was still running
four seconds after being asked to stop, and with a half second timer it came
out at once.
This commit is contained in:
Markus Hilger
2026-08-10 04:39:28 +02:00
parent 11dc8196b0
commit a53351a730
+12 -2
View File
@@ -156,8 +156,18 @@ class LibvirtBmc(bmc.Bmc):
self.stream.send(data)
def loop(self):
while self.check_console():
libvirt.virEventRunDefaultImpl()
# virEventRunDefaultImpl waits for an event, and an idle domain can go
# a long time without producing one. Give it a reason to return, or
# the loop never reconsiders check_console and the thread cannot be
# stopped at all: measured as never waking without this, and returning
# at once with it.
timer = libvirt.virEventAddTimeout(500, lambda *args: None, None)
try:
while self.check_console():
libvirt.virEventRunDefaultImpl()
finally:
if timer >= 0:
libvirt.virEventRemoveTimeout(timer)
def main():