Skip to content

Commit b72aebc

Browse files
committed
Inform clients about suspend
Since there is "resume", and there is a moment when resuming that domain might still be suspended, or event suspending a domain on purposed, allow clients to know the domain state.
1 parent b70518c commit b72aebc

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

qubes/vm/qubesvm.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,15 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.LocalVM):
447447
:param subject: Event emitter (the qube object)
448448
:param event: Event name (``'domain-unpaused'``)
449449
450+
.. event:: domain-suspended (subject, event)
451+
452+
Fired when the domain has been suspended.
453+
454+
Handler for this event may be asynchronous.
455+
456+
:param subject: Event emitter (the qube object)
457+
:param event: Event name (``'domain-suspended'``)
458+
450459
.. event:: domain-resumed (subject, event)
451460
452461
Fired when the domain has been resumed from suspend.
@@ -1771,6 +1780,7 @@ async def suspend(self):
17711780
self.libvirt_domain.pMSuspendForDuration(
17721781
libvirt.VIR_NODE_SUSPEND_TARGET_MEM, 0, 0
17731782
)
1783+
await self.fire_event_async("domain-suspended")
17741784
except libvirt.libvirtError as e:
17751785
if e.get_error_code() == libvirt.VIR_ERR_OPERATION_UNSUPPORTED:
17761786
# OS inside doesn't support full suspend, just pause it

0 commit comments

Comments
 (0)