Skip to content
This repository has been archived by the owner on Apr 26, 2020. It is now read-only.

Commit

Permalink
Add Started & Halted signals to DomainManager1
Browse files Browse the repository at this point in the history
  • Loading branch information
kalkin committed Jun 5, 2017
1 parent 9af4df7 commit b7b5604
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions qubesdbus/domain_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,23 @@ def __init__(self, data, domains):
'org.qubes.DomainManager1', data)
self.managed_objects = [self._proxify_domain(vm) for vm in domains]

for domain in self.managed_objects:
self._setup_signals(domain)

def _setup_signals(self, obj):
obj_path = obj._object_path # pylint: disable=protected-access

self.bus.add_signal_receiver(
lambda: self.Started("org.qubes.Domain", obj_path),
signal_name="Started", path=obj_path,
dbus_interface="org.qubes.Domain")

self.bus.add_signal_receiver(
lambda: self.Halted("org.qubes.Domain", obj_path),
signal_name="Halted", path=obj_path,
dbus_interface="org.qubes.Domain")


@dbus.service.method(dbus_interface='org.qubes.DomainManager1',
in_signature='a{sv}b')
def AddDomain(self, vm, execute=False):
Expand All @@ -86,6 +103,16 @@ def DomainAdded(self, _, object_path):
''' This signal is emitted when a new domain is added '''
self.log.debug("Emiting DomainAdded signal: %s", object_path)

@dbus.service.signal("org.qubes.DomainManager1", signature="so")
def Halted(self, _, object_path):
print("Halted %s" % object_path)
pass

@dbus.service.signal("org.qubes.DomainManager1", signature="so")
def Started(self, _, object_path):
print("Started %s" % object_path)
pass

@dbus.service.signal("org.qubes.DomainManager1", signature="so")
def DomainRemoved(self, _, object_path):
''' This signal is emitted when a new domain is removed '''
Expand Down

0 comments on commit b7b5604

Please sign in to comment.