+
    i*                     p  a  R% t+0 t R t^ RIt^ RIt^ RIt^ RIt^ RIt^ RIHt ^ RI	H
t
HtHt ^ RIHt ^ RIHt ^ RIHt ^ RIHt ^ RIHt R	tR
RR].R]R. /t] ^ k ]P2                  ! ]4      tR tR tR tR tR t R t!R t"R t#R]3R]3R]3R]3R] 3R]!3R]"3.t$R]#/t%R R lt&R  t'R! t(R" R# lt)R$ t*R# )&z:Resizefs: cloud-config module which resizes the filesystemN)Optional)	lifecyclesubputil)Cloud)Config)
MetaSchema)ALL_DISTROS)
PER_ALWAYSnoblockidcc_resizefsdistros	frequencyactivate_by_schema_keysc                 d   \         P                  ! V 4      '       g<   \        P                  P	                  R V ,          4      '       d   RRRRR V ,          .pMRRRRV .p\
        P                  P                  R4      p\
        P                  P                  \        P                  ! RR.4      P                  P                  R4      ^ ,          P                  R4      R
,          P                  4       4      pWC8  d+   VP                  R4      pVP                  V^,           R	4       \        V4      # )z%s/.snapshotsbtrfs
filesystemresizemaxz5.10z	--version
vz	--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idxs   &&    >/usr/lib/python3/dist-packages/cloudinit/config/cc_resizefs.py_resize_btrfsr,   %   s     ##K00RWW]]+%6 6 k)
 h{C
 !((11&9 ((11		7K()	dA		sB	 
	 +ii!

37K(:    c                 
    R V3# )	resize2fs r%   r&   s   &&r+   _resize_extr2   I   s      r-   c                 
    R V 3# )
xfs_growfsr0   r1   s   &&r+   _resize_xfsr5   M   s    +&&r-   c                     R RV 3# )growfsz-yr0   r1   s   &&r+   _resize_ufsr8   Q   s    dK((r-   c                     R RRW3# )zpoolonlinez-er0   r1   s   &&r+   _resize_zfsr<   U   s    Xt[99r-   c                     R RV 3# )hammer2r7   r0   r1   s   &&r+   _resize_hammer2r?   Y   s    x--r-   c                    RRRV3# )zSingle device resizebcachefsdevicer   r0   r1   s   &&r+   _resize_bcachefsrC   ]   s    (F33r-   c                     R pRp \         P                   ! RRV.4       R#   \         P                   d?   pTP                  P                  T4      '       d   Y4P                  9   d    Rp?R# ThRp?ii ; i)zgrowfs: requested sizez.is not larger than the current filesystem sizer7   z-NNTF)r   ProcessExecutionErrorstderr
startswith)r%   r&   
skip_startskip_containes   &&   r+   _can_skip_resize_ufsrK   b   si     *JCL		8T6*+  %% 88z**|xx/GGs   ! A41A/-A//A4r   extxfsufszfsr>   rA   c                :    V ^8  d   QhR\         \        ,          /# )   return)r   str)formats   "r+   __annotate__rU      s      # r-   c                    \         P                  ! 4       '       d   \        P                  M\        P                  p\
        P                  P                  R 4      '       g   \        P                  R4       R#  \        P                  ! RRV .4      w  r#V'       d   \        P                  RVV 4       R#  RpTP                  R4       Fa  p\        P                  ! YE4      '       g   K!  Y9  g   K)  R	T9  g   K2  TP                  4       ^ ,          p\        P                  R
Y4       Tu # 	  T! RYT4       R#   \        P                   d   pT! RY4        Rp?R# Rp?ii ; i)z/dev/zfsz"Cannot get zpool info, no /dev/zfsNr:   statusz0zpool status returned error: [%s] for zpool [%s]z$Unable to get zpool status of %s: %sz.*(ONLINE).*r   statezfound zpool "%s" on disk %sz'No zpool found: [%s]: out: [%s] err: %s)r   is_containerLOGdebugwarningr   r   existsr   inforE   r    research)r:   log_warnzpoolstatuserrrlinedisks   &      r+   get_device_info_from_zpoolrg      s    --//syyS[[H77>>*%%		6799gx%?@HHB
   	A!!$'99Q%"3t8K::<?DII3UAK	 (
 15s  %% 7Ds   9:D: :E#	EE#c                     V P                  4       p\        P                  4        F&  w  rEVP                  V4      '       g   K  V! W4      u # 	  R # )F)lowerRESIZE_FS_PRECHECK_CMDSitemsrG   )fs_typeresize_whatr&   	fstype_lcifuncs   &&&   r+   can_skip_resizerq      sC    I*002"",, 3 r-   c                   \         P                  ! 4       pV R8X  d   \        P                  P	                  V 4      '       gc   V'       g[   \         P
                  ! \         P                  ! 4       4      p V f   \        P                  R4       R# \        P                  RV 4       V R8X  d   \        P                  RW4       R# V P                  R4      '       d   \        P                  R4       V # V P                  R	4      '       gW   \        P                  P	                  V 4      '       g2   R	V P                  R
4      ,           p\        P                  RV V4       Tp  \        P                  ! V 4      p\        P                   ! TP"                  4      '       ga   \        P$                  ! TP"                  4      '       g;   T'       d   \        P                  RT T4       R# \        P                  RT T4       R# T #   \         d   pT'       d8   TP                  \        P                  8X  d   \        P                  RT T4       M8TP                  \        P                  8X  d   \        P                  RY4       MTh Rp?R# Rp?ii ; i)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': %szgpt/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)r   rY   r   r   r]   rootdev_from_cmdlineget_cmdlinerZ   r\   r[   rG   lstripstatOSErrorerrnoENOENTS_ISBLKst_modeS_ISCHR)devpathr^   	containerfulldevpathstatretexcs   &&    r+   maybe_get_writable_device_pathr      s    !!#I 	;w''++D,<,<,>??KK;<		BGL-		=wM
 &!!		78 g&&rww~~g/F/Fs 33		H	

 '''"  <<((goo1N1NII%	  KKC
 N=  ell2IIK
 YY%,,&KK> Is   G= =J
A7JJ
c          
      L    V ^8  d   QhR\         R\        R\        R\        RR/# )rQ   namecfgcloudargsrR   N)rS   r   r   list)rT   s   "r+   rU   rU      s6     M M M6 M% Mt M Mr-   c                 L   V'       d   V^ ,          pM\         P                  ! VRR4      p\         P                  ! V\        .R7      '       g   \        P                  RV 4       R# Rp\         P                  ! V\        4      pV'       g   \        P                  RV4       R# Vw  rxp	VR8X  d0   VP                  R4      ^ ,          p
\        V
4      pV'       g   R# T
pR	V: R
V	: RV: 2p\        P                  RV4       \        W{4      pV'       g   R# Rp\        WV4      '       d   \        P                  RW4       R# VP                  4       p\         F   w  rVP                  V4      '       g   K  Tp M	  V'       g   \        P                  RVV4       R# V! WW4      p\        P                  RWXRP                  V4      4       V\        8X  d   \         P                   ! \"        V4       M\#        V4       RpV\        8X  d   Rp\        P                  RVW4       R# )    resize_rootfsT)addonsz+Skipping module named %s, resizing disabledNrt   z)Could not determine filesystem type of %srO   zdev=z mnt_point=z path=zresize_info: %sz%Skip resize filesystem type %s for %sz.Not resizing unknown filesystem type %s for %szResizing %s (%s) using %s ResizedzResizing (via forking)z$%s root filesystem (type=%s, val=%s))r   get_cfg_option_strtranslate_boolNOBLOCKrZ   r[   get_mount_infor\   r    rg   r   rq   ri   RESIZE_FS_PREFIXES_CMDSrG   joinfork_cb	do_resize)r   r   r   r   resize_rootrm   resultr&   rl   r%   r:   r^   resizerrn   pfixroot_cmd
resize_cmdactions   &&&&              r+   handler      s   1g--c?DI{G9==		?F K  c2F?M%+"Vk %S!!$+E2,2KMDII&+F9FGwV44		3W	
 	I1%%G 2
 <	

 	-JII#[388J;O g 		

 	*Fg)II.r-   c                      \         P                   ! V 4       R#   \         P                   d    \        P                  ! \        R T 4       h i ; i)z$Failed to resize filesystem (cmd=%s)N)r   rE   r   logexcrZ   )r   s   &r+   r   r   K  s<    		*%% C?Ls	    3Ac                @    V ^8  d   Qh/ ^ \         9   d
   \        ;R&   # )rQ   meta)__conditional_annotations__r   )rT   s   "r+   rU   rU   	   s     @ @$ j % Ar-   ),r   __doc__rz   loggingr   r_   rx   typingr   	cloudinitr   r   r   cloudinit.cloudr   cloudinit.configr   cloudinit.config.schemar   cloudinit.distrosr	   cloudinit.settingsr
   r   r   	getLogger__name__rZ   r,   r2   r5   r8   r<   r?   rC   rK   r   rj   rg   rq   r   r   r   rU   )r   s   @r+   <module>r      s   A   	 	   + + ! # . ) )
 	-}r	  !!H!'):.4
. m
K
K
K
K !"  !"67 <M`M`r-   