MINI MINI MANI MO

Path : /usr/lib/python2.7/site-packages/tuned/hardware/
File Upload :
Current File : //usr/lib/python2.7/site-packages/tuned/hardware/inventory.pyc

ó
©=[c@spddlZddlZddlmZdgZejjƒZdefd„ƒYZ	defd„ƒYZ
dS(iÿÿÿÿN(tconstst	InventorycBseeZdZd	d	d	d	d„Zd„Zd„Zd„Zd„Zd„Z	d„Z
d	d„ZRS(
s‰
	Inventory object can handle information about available hardware devices. It also informs the plugins
	about related hardware events.
	cCs³|dk	r||_ntjƒ|_|dkr?tj}n|j|jƒ|_|dkrltj}n|jj	|ƒ|dkr”t
ƒ}n||_d|_i|_
dS(N(tNonet
_udev_contexttpyudevtContexttMonitortfrom_netlinkt
_udev_monitorRtCFG_DEF_UDEV_BUFFER_SIZEtset_receive_buffer_sizet_MonitorObserverFactoryt_monitor_observer_factoryt_monitor_observert_subscriptions(tselftudev_contexttudev_monitor_clstmonitor_observer_factorytbuffer_size((s</usr/lib/python2.7/site-packages/tuned/hardware/inventory.pyt__init__s		cCsKytjj|j||ƒSWn'tk
rFtjj|j||ƒSXdS(s9Get a pyudev.Device object for the sys_name (e.g. 'sda').N(RtDevicest	from_nameRtAttributeErrortDevice(Rt	subsystemtsys_name((s</usr/lib/python2.7/site-packages/tuned/hardware/inventory.pyt
get_device#s
cCs|jjd|ƒS(s)Get list of devices on a given subsystem.R(Rtlist_devices(RR((s</usr/lib/python2.7/site-packages/tuned/hardware/inventory.pytget_devices+scCs5|jjƒx!|jD]}|jj|ƒqWdS(N(Rt
remove_filterRt	filter_by(RR((s</usr/lib/python2.7/site-packages/tuned/hardware/inventory.pyt_remove_unused_filters/s
cCs€|j|jkrdSxc|j|jD]Q\}}y|||ƒWq'tk
rw}tjd|ƒtj|ƒq'Xq'WdS(Ns+Exception occured in event handler of '%s'.(RRt	Exceptiontlogterrort	exception(Rteventtdevicetplugintcallbackte((s</usr/lib/python2.7/site-packages/tuned/hardware/inventory.pyt_handle_udev_event4scCs·tjd||fƒ||f}||jkrI|j|j|ƒn |g|j|<|jj|ƒ|jdkr³tjdƒ|jj	|j|j
ƒ|_|jjƒndS(s7Register handler of device events on a given subsystem.sadding handler: %s (%s)sstarting monitor observerN(R"tdebugRtappendRRR
RRtcreateR*tstart(RR'RR(t
callback_data((s</usr/lib/python2.7/site-packages/tuned/hardware/inventory.pyt	subscribe?s
cCsbx[|j|D]L}|\}}||krtjd||fƒ|j|j|ƒqqWdS(Nsremoving handler: %s (%s)(RR"R+tremove(RR'RR/t_pluginR(((s</usr/lib/python2.7/site-packages/tuned/hardware/inventory.pyt_unsubscribe_subsystemNs
cCs×g}xe|jD]Z}|dks.||kr|j||ƒt|j|ƒdkrj|j|ƒqjqqWx|D]}|j|=quWt|jƒdkrÓ|jdk	rÓtjdƒ|jjƒd|_ndS(s4Unregister handler registered with subscribe method.isstopping monitor observerN(	RRR3tlenR,R
R"R+tstop(RR'Rtempty_subsystemst
_subsystem((s</usr/lib/python2.7/site-packages/tuned/hardware/inventory.pytunsubscribeUs
$

N(t__name__t
__module__t__doc__RRRRR R*R0R3R8(((s</usr/lib/python2.7/site-packages/tuned/hardware/inventory.pyR	s						RcBseZd„ZRS(cOstj||ŽS(N(RtMonitorObserver(Rtargstkwargs((s</usr/lib/python2.7/site-packages/tuned/hardware/inventory.pyR-gs(R9R:R-(((s</usr/lib/python2.7/site-packages/tuned/hardware/inventory.pyRfs(Rt
tuned.logsttunedRt__all__tlogstgetR"tobjectRR(((s</usr/lib/python2.7/site-packages/tuned/hardware/inventory.pyt<module>s	]

OHA YOOOO