Nir Soffer has posted comments on this change.
Change subject: monitor: Add udev monitor ......................................................................
Patch Set 7:
(2 comments)
https://gerrit.ovirt.org/#/c/47729/7/lib/vdsm/udev/monitor.py File lib/vdsm/udev/monitor.py:
Line 34: monitoring thread only starts listening on the socket when the monitor is Line 35: started and at least one subscriber is added. Line 36: Line 37: The simplest way to use the monitor is to subscribe a callback to a Line 38: specific subsystem event and let the callback do the work:
This will end in people blocking each other by invoking blocking calls du
Lets hear other people opinion on this. Line 39: Line 40: dev listen_for_disabled_cpu_events(device): Line 41: if device.action == 'offline': Line 42: print('CPU {0.name} is now offline'.format(device))
Line 77: if device.device_type: Line 78: for callback in subsystem.get(None, []): Line 79: _execute_callback(callback, device) Line 80: Line 81: def subscribe(self, callback, subsystem, device_type=None):
Unsubscribe is not possible because we can only remove all filters at once.
Not being able to unsubscribe is sad for publish and subscribe system. Line 82: """ Line 83: Raise :exc:`~exceptions.ValueError` if the callback is None Line 84: Line 85: :param callback: function to invoke