Your IP : 172.28.240.42


Current Path : /usr/lib/python2.7/dist-packages/landscape/monitor/
Upload File :
Current File : //usr/lib/python2.7/dist-packages/landscape/monitor/mountinfo.pyc

ó
ÍÿŠTc@sxddlZddlZddlmZmZddlmZddlmZddl	m
Z
de
fd„ƒYZdS(iÿÿÿÿN(tget_mount_infotis_device_removable(tCoverageMonitor(tAccumulator(t
MonitorPlugint	MountInfocBs•eZdZdZdZdddejddd„Zd„Zd	„Z	d
„Z
d„Zed„Z
d
„Zd„Zd„Zd„Zd„ZRS(s
mount-infotdiskiÈi,i<s/proc/mountss	/etc/mtabcCs||_||_||_||_||_|dkrEtj}n||_||_g|_	g|_
d|_t|_dS(N(
trun_intervalt_monitor_intervalt_create_timet_mounts_filet
_mtab_filetNonetoststatvfst_statvfst_free_spacet_mount_infot_mount_info_to_persistR(tselftintervaltmonitor_intervaltmounts_filetcreate_timeRt	mtab_file((s?/usr/lib/python2.7/dist-packages/landscape/monitor/mountinfo.pyt__init__s										cCs­tt|ƒj|ƒt|j|jjƒ|_t|j	ddd|j
ƒ|_|jjj
|j|jjƒ|jjjd|jjddƒ|jd|jtƒdS(Ngš™™™™™é?smount info snapshotRtstoptpriorityiÐs
mount-info(tsuperRtregisterRt_persisttregistryt	step_sizet_accumulateRRR	t_monitortreactort
call_everyRtlogtcall_ontcall_on_acceptedt
send_messagestTrue(RR((s?/usr/lib/python2.7/dist-packages/landscape/monitor/mountinfo.pyR"s
"cCstd|jƒ|jƒgƒS(N(tfilterRtcreate_mount_info_messagetcreate_free_space_message(R((s?/usr/lib/python2.7/dist-packages/landscape/monitor/mountinfo.pytcreate_messages-scCs>|jr:idd6|jd6}|j|_g|_|SdS(Ns
mount-infottype(RRR(Rtmessage((s?/usr/lib/python2.7/dist-packages/landscape/monitor/mountinfo.pyR+1s	
	cCsH|jrD|j|j }idd6|d6}|j|j|_|SdS(Ns
free-spaceR.(Rt max_free_space_items_to_exchangeR(Rtitems_to_exchangeR/((s?/usr/lib/python2.7/dist-packages/landscape/monitor/mountinfo.pyR,9s	



csex^ˆjƒD]P}ˆjjj|ˆjd|ƒ}|ddkr
|j‡fd†ƒq
q
WdS(NturgentR.s
mount-infocs
ˆjƒS(N(tpersist_mount_info(tx(R(s?/usr/lib/python2.7/dist-packages/landscape/monitor/mountinfo.pyt<lambda>Is(R-Rtbrokertsend_messaget_session_idtaddCallback(RR2R/td((Rs?/usr/lib/python2.7/dist-packages/landscape/monitor/mountinfo.pyR(Ds
cCs|jjjd|jƒdS(Ns
mount-info(RR6tcall_if_acceptedR((R((s?/usr/lib/python2.7/dist-packages/landscape/monitor/mountinfo.pytexchangeKscCsWx:|jD]/\}}|d}|jjd|f|ƒq
Wd|_|jjƒdS(Nsmount-points
mount-info(RRtsetRRtflush(Rt	timestampt
mount_infotmount_point((s?/usr/lib/python2.7/dist-packages/landscape/monitor/mountinfo.pyR3Os

	cCs5|jjƒt|jƒƒ}tƒ}x|jƒD]ø}|d}|jdƒ}d|f}|j|||ƒ}|r±|d}t|dƒ}|jj	|||fƒn|j
jd|fƒ}	|	sÜ|	|kr |g|jD]\}
}|^qékr |jj	||fƒq n|j
|ƒq5WdS(Nsmount-points
free-spacesaccumulate-free-spaceiis
mount-info(R"tpingtintR	R=t_get_mount_infotpopR!RtappendRtgetRtadd(Rtnowtcurrent_mount_pointsR@RAt
free_spacetkeyt	step_dataR?tprev_mount_infotttm((s?/usr/lib/python2.7/dist-packages/landscape/monitor/mountinfo.pytrunYs"
	

(ccs‡|jƒ}xtt|j|jƒD]]}|d}|d}|jdƒr"|jdƒr"|j|ƒr"||kr"|Vq"q"WdS(s=Generator yields local mount points worth recording data for.tdevicesmount-points/dev/N(t_get_bound_mount_pointsRR
Rt
startswithR(Rtbound_mount_pointstinfoRRRA((s?/usr/lib/python2.7/dist-packages/landscape/monitor/mountinfo.pyRDos

cCs¿tƒ}|js)tjj|jƒr-|St|jdƒ}xy|D]q}y/|jƒd \}}}}|jdƒ}Wntk
r‘qFnXd|jdƒkrF|j	|ƒqFqFW|S(si
        Returns a set of mount points that have the "bind" option
        by parsing /etc/mtab.
        tris
string-escapetbindt,(
R=RR
tpathtisfiletopentsplittdecodet
ValueErrorRH(Rtbound_pointstfiletlineRRRAt
filesystemtoptions((s?/usr/lib/python2.7/dist-packages/landscape/monitor/mountinfo.pyRS|s	 

iN(t__name__t
__module__tpersist_nametscopeR0ttimeRRRR-R+R,tFalseR(R<R3RQRDRS(((s?/usr/lib/python2.7/dist-packages/landscape/monitor/mountinfo.pyR
s 							
		
(RiR
tlandscape.lib.diskRRtlandscape.lib.monitorRtlandscape.accumulateRtlandscape.monitor.pluginRR(((s?/usr/lib/python2.7/dist-packages/landscape/monitor/mountinfo.pyt<module>s