ok

Mini Shell

Direktori : /proc/self/root/proc/self/root/usr/lib/python2.7/site-packages/yum/
Upload File :
Current File : //proc/self/root/proc/self/root/usr/lib/python2.7/site-packages/yum/fssnapshots.pyc

�
8M�bc@s�ddlZddlZddlZddlmZddlZddlmZyrddlZej�Z	e	j
�dZ	e	j
d�dZ	eee
e	j
d���Z	e	dkr�dZnWndZdZ	nXedk	r
dd	lmZd
efd��YZndZd�Zd
�Zd�Zd�Zd�Zdd�Zd�Zd�Zd�Zd�Zdefd��YZdS(i����N(tdatetime(t_it(t.iic(tLibLVMErrort_ResultErrorcBseZdZRS(s>Exception raised for LVM calls resulting in bad return values.(t__name__t
__module__t__doc__(((s3/usr/lib/python2.7/site-packages/yum/fssnapshots.pyRscCs,|j�}|dsdS|dddkS(NitotO(R	R
(tgetAttrtNone(tlvtsnap((s3/usr/lib/python2.7/site-packages/yum/fssnapshots.pyt
_is_origin%s
cCs,|j�}|dsdS|dddkS(NitstS(RR(RR(R
R((s3/usr/lib/python2.7/site-packages/yum/fssnapshots.pyt_is_snap,s
cCs,|j�}|dsdS|dddkS(Nitv(RR(R
R((s3/usr/lib/python2.7/site-packages/yum/fssnapshots.pyt_is_virt3s
cCs y|j|�SWndSXdS(N(t
lvFromNameR(tvgtlvname((s3/usr/lib/python2.7/site-packages/yum/fssnapshots.pyt_vg_name2lv:scCsytj�}Wntk
r)g}nX|stjddddgdtjdtj�}|j�}|r�ttd���n|j	�d}|j
d	�}|s�gS|dj�}|d
kr�gSg}x2|dD]#}|s�Pn|j|j��q�Wn|S(Ns	/sbin/lvmtvgss-otvg_nametstdouttstderrs#Failed to obtain volume group namesis
tVGi(
tlvmtlistVgNamesRt
subprocesstPopentPIPEtwaitRRtcommunicatetsplittstriptappend(tnamestpterrtoutputtheadertname((s3/usr/lib/python2.7/site-packages/yum/fssnapshots.pyt_list_vg_names@s.

cCs�t|�dkr�t|dd!�d}|t|dd!�7}|d9}|ddkrg||8}n|ddkr�||7}q�n|S(Niiii<it+t-(tlentint(tztctimetoff((s3/usr/lib/python2.7/site-packages/yum/fssnapshots.pyt_z_off]s

cCs�y�|j�\}}}tj|d|d�}tj|�}tr�tjd�}||kr�t|�}t|�}|||7}q�nWn
d}nX|S(Nt s%Y-%m-%d %H:%M:%Ss%zi(R%ttimetstrptimetmktimetFalsetstrftimeR6(R4tdttR3tcur_z((s3/usr/lib/python2.7/site-packages/yum/fssnapshots.pyt
_lv_ctime2utchs
c
Cs�|j�}|j�}|j�}|jd�d}|j�}t|jd�d�}|jd�d}t|�}|d}id||fd6|d	6|d6d||fd
6|j�d6|d6|d
6|d6}	|	S(Ntoriginitlv_timetsnap_percentii�s%s/%stdevR4t
origin_devtfreettagstsizetusedi�i@B(tgetNametgetSizetgetPropertytgetTagsR@tfloattgetFreeSize(
RR
tvgnameRRHRARGR4RItdata((s3/usr/lib/python2.7/site-packages/yum/fssnapshots.pyt_lv_data{s$


cs�fd�}|S(s7Decorator for _FSSnap methods that logs LVM tracebacks.csSy�|||�SWn8tk
rN}|jdk	rH|jj|�n�nXdS(N(Rt_loggerRt	exception(tselftargstkwargste(tfunc(s3/usr/lib/python2.7/site-packages/yum/fssnapshots.pytwrap�s((RYRZ((RYs3/usr/lib/python2.7/site-packages/yum/fssnapshots.pyt_log_traceback�scCs@t|�tkr2t|j�dkr2|jdSt|�SdS(s;Convert a LibLVMError instance to a readable error message.iiN(ttypeRR1RVtstr(texc((s3/usr/lib/python2.7/site-packages/yum/fssnapshots.pyt
lvmerr2str�s't_FSSnapcBs�eZdedd
d�Zed��Zd
d�Zedd��Z	eddd
id	��Z
ed
��Zegd��ZRS(t/s!*/swaps
!*/lv_swapcCs�tstj�rg}nt|_tto=tjjd��|_d|_	d|_||_||_
d|_||_|j
s�dSdS(Ns	/sbin/lvmt_yum_(Rtostgeteuidt_vertversiontbooltpathtexistst	availabletpostfix_staticRt_postfixt_roott_devst_vgname_listRS(RUtroott
lookup_mountstdevicestlogger((s3/usr/lib/python2.7/site-packages/yum/fssnapshots.pyt__init__�s		!							cCs4|jdkr-|jr!t�ng|_n|jS(N(RoRRjR.(RU((s3/usr/lib/python2.7/site-packages/yum/fssnapshots.pyt_vgnames�sc	Cs|dk	r+t|�s$t|�r+tSnt}x�|jD]�}d|krSq;nt}|ddkr�t}t}|d}n|jdd�\}}d|kr�q;ntj||�s�q;n|dkr�|S|dkr�dS|j�}tj||�s	q;n|SW|S(NRait!it*(	RRRR;RntTrueR%tfnmatchRJ(	RURPR
t	found_negRDtnegtvgntlvnR((s3/usr/lib/python2.7/site-packages/yum/fssnapshots.pyt_use_dev�s4
idc	Cs�t}x�|jD]�}|j|�}|dk	r>|r>qntj|d�}|sottd�|��n|j�}d}x<|j	�D].}|j||�s�q�n||j
�7}q�W|j�|s�qnt}||d|krtSqW|S(s0 See if we have enough space to try a snapshot. trs(Unknown error when opening volume group iidN(
R;RuR~RRtvgOpenRRROtlistLVsRKtcloseRx(	RUt
percentagetretRPtuseRtvgfsizetlvssizeR
((s3/usr/lib/python2.7/site-packages/yum/fssnapshots.pyt	has_space�s,
tcCs|dkr1d|jtj�jd�f}ng}x�|jD]�}|j|�}|dk	ro|roqAntj|d�}|s�t	t
d�|��nxZ|j�D]L}	|	j�}
|j||	�s�q�nd||
|f}|	j
||	j�|d�}|s3|j�t	t
d�|��nd||
f}
d||f}t�}x�||
d	fD]v}xm|j|g�D]Y}d
|kr�|jd
d�\}}||kr�q�n|j|�n|j|�q�WqlW|j|
|f�q�W|j�qAW|S(
sc Attempt to take a snapshot, note that errors can happen after
            this function succeeds. s%s%ss%Y%m%d%H%M%S.%ftws(Unknown error when opening volume group s%s%s%sids%Unknown error when creating snapshot s%s/%sRwt=iN(RRkRtnowR<RuR~RR�RRR�RJtsnapshotRKR�tsettgetR%taddtaddTagR'(RUR�tprefixtpostfixRGR�RPR�RR
Rtnlvnametnlvtodevtndevteq_tagstvalttagt
eq_tag_keyt
eq_tag_val((s3/usr/lib/python2.7/site-packages/yum/fssnapshots.pyR�sF% 
	cCs�g}x�|jD]�}tj|d�}|sGttd�|��nx<|j�D].}t|�slqTn|jt||��qTW|j	�qW|S(s List data for old snapshots. R�s(Unknown error when opening volume group (
RuRR�RRR�RR'RRR�(RUR�RPRR
((s3/usr/lib/python2.7/site-packages/yum/fssnapshots.pyt
old_snapshotsFsc	Cs!ts
gSg}i}xV|D]N}|jd�\}}||krZt|g�||<q||j|�qWx�|D]�}tj|d�}|s�ttd�|��nx_||D]S}t||�}|s�q�nt|�s�q�n|j	t
||��|j�q�W|j�qvW|S(s Remove snapshots. RaR�s(Unknown error when opening volume group (
RR%R�R�R�RRRRR'RRtremoveR�(	RURrR�ttogoRDRPRRR
((s3/usr/lib/python2.7/site-packages/yum/fssnapshots.pyt
del_snapshots^s0

(s!*/swaps
!*/lv_swapN(
RRRxRRttpropertyRuR~R[R�R�R�R�(((s3/usr/lib/python2.7/site-packages/yum/fssnapshots.pyR`�s'#4(iiic(RcRyR8RR tyumRRt
getVersionReR%ttupletmapR2RRRRRRRR.R6R@RRR[R_tobjectR`(((s3/usr/lib/python2.7/site-packages/yum/fssnapshots.pyt<module>s>

										

Zerion Mini Shell 1.0