Current Dir: /snap/core22/2955/usr/lib/python3/dist-packages/cloudinit/config/__pycache__/

[FILE] cc_ansible.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_apk_configure.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_apt_configure.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_apt_pipelining.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_bootcmd.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_byobu.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_ca_certs.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_chef.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_disable_ec2_metadata.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_disk_setup.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_fan.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_final_message.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_growpart.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_grub_dpkg.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_install_hotplug.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_keyboard.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_keys_to_console.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_landscape.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_locale.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_lxd.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_mcollective.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_mounts.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_ntp.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_package_update_upgrade_install.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_phone_home.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_power_state_change.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_puppet.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_raspberry_pi.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_reset_rmc.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_resizefs.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_resolv_conf.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_rh_subscription.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_rsyslog.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_runcmd.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_salt_minion.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_scripts_per_boot.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_scripts_per_instance.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_scripts_per_once.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_scripts_user.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_scripts_vendor.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_seed_random.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_set_hostname.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_set_passwords.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_snap.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_spacewalk.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_ssh.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_ssh_authkey_fingerprints.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_ssh_import_id.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_timezone.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_ubuntu_autoinstall.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_ubuntu_drivers.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_ubuntu_pro.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_update_etc_hosts.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_update_hostname.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_users_groups.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_wireguard.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_write_files.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_write_files_deferred.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_yum_add_repo.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_zypper_add_repo.cpython-310.pyc [ edit | delete | rename ]
[FILE] modules.cpython-310.pyc [ edit | delete | rename ]
[FILE] schema.cpython-310.pyc [ edit | delete | rename ]
[FILE] __init__.cpython-310.pyc [ edit | delete | rename ]

Viewing: /snap/core22/2955/usr/lib/python3/dist-packages/cloudinit/config/__pycache__/cc_resizefs.cpython-310.pyc

o

��i�*�
@srUdZddlZddlZddlZddlZddlZddlmZddlm	Z	m
Z
mZddlm
Z
ddlmZddlmZddlmZdd	lmZd
Zdegegd�Zeed
<e�e�Zdd�Zdd�Zdd�Zdd�Zdd�Z dd�Z!dd�Z"dd�Z#defdefd efd!efd"e fd#e!fd$e"fgZ$d!e#iZ%d%ee&fd&d'�Z'd(d)�Z(d*d+�Z)d,e&d-ed.e
d/e*d%df
d0d1�Z+d2d3�Z,dS)4z:Resizefs: cloud-config module which resizes the filesystem�N)�Optional)�	lifecycle�subp�util)�Cloud)�Config)�
MetaSchema)�ALL_DISTROS)�
PER_ALWAYS�noblock�cc_resizefs)�id�distros�	frequency�activate_by_schema_keys�metacCs�t�|�stj�d|�rddddd|g}ndddd|g}tj�d�}tj�t�ddg�j	�
d�d	�
d
�d���}||krM|�d�}|�
|dd
�t|�S)Nz
%s/.snapshots�btrfs�
filesystem�resize�maxz5.10z	--version�
r�v����z	--enqueue)r�mount_is_read_write�os�path�isdirr�Version�from_strr�stdout�split�strip�index�insert�tuple)�mount_point�devpth�cmd�btrfs_with_queue�system_btrfs_ver�idx�r,�>/usr/lib/python3/dist-packages/cloudinit/config/cc_resizefs.py�
_resize_btrfs%s.��
���
r.cCsd|fS)N�	resize2fsr,�r&r'r,r,r-�_resize_extI�r1cCsd|fS)N�
xfs_growfsr,r0r,r,r-�_resize_xfsMr2r4cC�
dd|fS)N�growfsz-yr,r0r,r,r-�_resize_ufsQ�
r7cCsddd||fS)N�zpool�onlinez-er,r0r,r,r-�_resize_zfsUsr;cCr5)N�hammer2r6r,r0r,r,r-�_resize_hammer2Yr8r=cCsddd|fS)zSingle device resize�bcachefs�devicerr,r0r,r,r-�_resize_bcachefs]sr@c
Csbd}d}zt�dd|g�WdStjy0}z|j�|�r*||jvr*WYd}~dS|�d}~ww)Nzgrowfs: requested sizez.is not larger than the current filesystem sizer6z-NTF)r�ProcessExecutionError�stderr�
startswith)r&r'�
skip_start�skip_contain�er,r,r-�_can_skip_resize_ufsbs���rGr�ext�xfs�ufs�zfsr<r>�returnc
Cs�t��rtjntj}tj�d�st�d�dSzt�dd|g�\}}|r.t�	d||�WdSWntj
yI}z
|d||�WYd}~dSd}~wwd}|�d�D]!}t�
||�rr||vrrd	|vrr|��d
}t�d||�|SqQ|d|||�dS)
Nz/dev/zfsz"Cannot get zpool info, no /dev/zfsr9�statusz0zpool status returned error: [%s] for zpool [%s]z$Unable to get zpool status of %s: %sz.*(ONLINE).*r�staterzfound zpool "%s" on disk %sz'No zpool found: [%s]: out: [%s] err: %s)r�is_container�LOG�debug�warningrr�existsr�inforAr!�re�search)r9�log_warn�zpoolstatus�err�r�line�diskr,r,r-�get_device_info_from_zpool�s<
������r]cCs6|��}t��D]\}}|�|�r|||�SqdS)NF)�lower�RESIZE_FS_PRECHECK_CMDS�itemsrC)�fs_type�resize_whatr'�	fstype_lc�i�funcr,r,r-�can_skip_resize�s
�rfc
Csrt��}|dkr(tj�|�s(|s(t�t���}|dur"t�d�dSt�	d|�|dkr5t�	d||�dS|�
d�rAt�	d�|S|�
d	�s\tj�|�s\d	|�d
�}t�	d||�|}zt�|�}Wn3t
y�}z'|r{|jtjkr{t�	d||�n|jtjkr�t�d
||�n|�WYd}~dSd}~wwt�|j�s�t�|j�s�|r�t�	d||�dSt�d||�dS|S)a�Return updated devpath if the devpath is a writable block device.

    @param devpath: Requested path to the root device we want to resize.
    @param info: String representing information about the requested device.
    @param log: Logger to which logs will be added upon error.

    @returns devpath or updated devpath per kernel command line if the device
        path is a writable block device, returns None otherwise.
    z	/dev/rootNz!Unable to find device '/dev/root'z.Converted /dev/root to '%s' per kernel cmdline�overlayrootz)Not attempting to resize devpath '%s': %szgpt/z#We have a gpt label - just go aheadz/dev/�/z:'%s' doesn't appear to be a valid device path. Trying '%s'z9Device '%s' did not exist in container. cannot resize: %sz,Device '%s' did not exist. cannot resize: %sz>device '%s' not a block device in container. cannot resize: %sz1device '%s' not a block device. cannot resize: %s)rrOrrrS�rootdev_from_cmdline�get_cmdlinerPrRrQrC�lstrip�stat�OSError�errno�ENOENT�S_ISBLK�st_mode�S_ISCHR)�devpathrT�	container�fulldevpath�statret�excr,r,r-�maybe_get_writable_device_path�sr

��


��������rx�name�cfg�cloud�argscCs�|r|d}nt�|dd�}tj|tgd�st�d|�dSd}t�|t�}|s0t�d|�dS|\}}}	|dkrJ|�d�d}
t	|
�}|sHdS|
}d	||	|f}t�d
|�t
||�}|s`dSd}t|||�rqt�d||�dS|��}
t
D]
\}}|
�|�r�|}nqw|s�t�d||�dS|||�}t�d
||d�|��|tkr�t�t|�nt|�d}|tkr�d}t�d|||�dS)Nr�
resize_rootfsT)�addonsz+Skipping module named %s, resizing disabledrhz)Could not determine filesystem type of %srKzdev=%s mnt_point=%s path=%szresize_info: %sz%Skip resize filesystem type %s for %sz.Not resizing unknown filesystem type %s for %szResizing %s (%s) using %s� �ResizedzResizing (via forking)z$%s root filesystem (type=%s, val=%s))r�get_cfg_option_str�translate_bool�NOBLOCKrPrQ�get_mount_inforRr!r]rxrfr^�RESIZE_FS_PREFIXES_CMDSrC�join�fork_cb�	do_resize)ryrzr{r|�resize_rootrb�resultr'rar&r9rT�resizerrc�pfix�root_cmd�
resize_cmd�actionr,r,r-�handle�st


�
��
���r�cCs2zt�|�WdStjyt�td|��w)Nz$Failed to resize filesystem (cmd=%s))rrAr�logexcrP)r�r,r,r-r�Ks�r�)-�__doc__rn�loggingrrUrl�typingr�	cloudinitrrr�cloudinit.cloudr�cloudinit.configr�cloudinit.config.schemar�cloudinit.distrosr	�cloudinit.settingsr
r�r�__annotations__�	getLogger�__name__rPr.r1r4r7r;r=r@rGr�r_�strr]rfrx�listr�r�r,r,r,r-�<module>sT�
$�
PP
Upload File: