MOON
Server: Apache
System: Linux vps.erhabenn.com.br 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64
User: machen (1008)
PHP: 8.2.31
Disabled: NONE
Upload Files
File: //lib/python2.7/site-packages/azurelinuxagent/daemon/resourcedisk/freebsd.pyo
�
d�bc@s�ddlZddljjZddljjjZddljjjZddl	jj
Z
ddlmZddl
mZdefd��YZdS(i����N(tResourceDiskError(tResourceDiskHandlertFreeBSDResourceDiskHandlercBs8eZdZd�Zed��Zd�Zd�ZRS(s�
    This class handles resource disk mounting for FreeBSD.

    The resource disk locates at following slot:
    scbus2 on blkvsc1 bus 0:
    <Msft Virtual Disk 1.0>            at scbus2 target 1 lun 0 (da1,pass2)

    There are 2 variations based on partition table type:
    1. MBR: The resource disk partition is /dev/da1s1
    2. GPT: The resource disk partition is /dev/da1p2, /dev/da1p1 is for reserved usage.
    cCstt|�j�dS(N(tsuperRt__init__(tself((sO/usr/lib/python2.7/site-packages/azurelinuxagent/daemon/resourcedisk/freebsd.pyR)scCsli}x_|jd�D]N}|jd�dkr>|d}q|jd�dkr|d||<qqW|S(Ns
sGeom name: i����isscheme: i(tsplittfind(tdatatdictlinet	geom_name((sO/usr/lib/python2.7/site-packages/azurelinuxagent/daemon/resourcedisk/freebsd.pytparse_gpart_list,s
cCsS|j}|dkr-tdj|���ntjd�\}}|r`tdj|���n|j|�}|jjd�}|dks�||krEtjd�\}}|r�tjd�\}}|r�tdj|���q�nxX|j	d�D]D}|j
d	�}|d
kr�|| }	|	|kr>|	}Pq>q�q�Wn|sZtd��ntjd|�||}
|
d
kr�|d}n.|
dkr�|d}ntdj|���tjdj|��\}}|s�|j
|�dkrtd��nd|}tjd|�tjd�d}
|jj
|
|�}|r_tjd|�|Stj|dd�dj|||�}tj|dt�}|r9tjdj||��tjdj|��\}}|r�tdj||���ntj|dt�\}}|r9td j||���q9ntjd!|||�|S("Ntufss7Unsupported filesystem type:{0}, only ufs is supported.s
gpart lists)Unable to detect resource disk device:{0}iscamcontrol periphlist 2:1:0scamcontrol periphlist 3:1:0s
t:is&Unable to detect resource disk device.sResource disk device {0} found.tMBRts1tGPTtp2s$Unsupported partition table type:{0}sgpart show -p {0}i����s"Resource disk partition not found.s/dev/s"Resource disk partition {0} found.tmounts$Resource disk {0} is already mountedtmodei�smount -t {0} {1} {2}tchk_errs(Creating {0} filesystem on partition {1}snewfs -U {0}s;Failed to create new filesystem on partition {0}, error:{1}s(Failed to mount partition {0}, error {1}s=Resource disk partition {0} is mounted at {1} with fstype {2}(tfsRtformatt	shellutiltrun_get_outputRtosutiltdevice_for_ide_porttNoneRRtloggertinfotget_mount_pointtfileutiltmkdirtruntFalse(Rtmount_pointRterrtoutputtdiskstdeviceR
tindexRtpartition_table_typet
provider_namet	partitiont
mount_listtexistingt	mount_cmd((sO/usr/lib/python2.7/site-packages/azurelinuxagent/daemon/resourcedisk/freebsd.pytmount_resource_disk6s�	





cCs$|d}|d}tjj|d�}tjd�d}|j|||�rUdStjj|�r�tjj|�|kr�tj	d�tj
dj|�dt�tj
|�ntjj|�s�tj	d�|j||d�ntjd	j|��dj�}tj
d
j|��tj�r�tj
d�tj
d�tj
d
�tj
dj|��tj
dj|��tj
dj|��r�tdj|���ntj	dj|||��nLtj
dj|��rtdj|���ntj	dj|||��dS(Nitswapfiles
swapctl -lisRemove old swap filesswapoff {0}RsCreate swap filesmdconfig -a -t vnode -f {0}schmod 0600 /dev/{0}s
kldload aesniskldload cryptodevskldload geom_elis*geli onetime -e AES-XTS -l 256 -d /dev/{0}schmod 0600 /dev/{0}.elisswapon /dev/{0}.elis/dev/{0}.elis+Enabled {0}KB of swap at /dev/{1}.eli ({2})sswapon /dev/{0}s/dev/{0}s'Enabled {0}KB of swap at /dev/{1} ({2})(tostpathtjoinRRtcheck_existing_swap_filetisfiletgetsizeRRR"RR#tremovetmkfiletrstriptconft'get_resourcedisk_enable_swap_encryptionR(RR$tsize_mbtsize_kbtsizeR1tswaplisttmddevice((sO/usr/lib/python2.7/site-packages/azurelinuxagent/daemon/resourcedisk/freebsd.pytcreate_swap_space�s>

*




(t__name__t
__module__t__doc__RtstaticmethodRR0RB(((sO/usr/lib/python2.7/site-packages/azurelinuxagent/daemon/resourcedisk/freebsd.pyRs
	
	\(R2tazurelinuxagent.common.loggertcommonRt%azurelinuxagent.common.utils.fileutiltutilsR t&azurelinuxagent.common.utils.shellutilRtazurelinuxagent.common.confR;t azurelinuxagent.common.exceptionRt+azurelinuxagent.daemon.resourcedisk.defaultRR(((sO/usr/lib/python2.7/site-packages/azurelinuxagent/daemon/resourcedisk/freebsd.pyt<module>s