| Server IP : 23.254.227.96 / Your IP : 216.73.216.183 Web Server : Apache/2.4.62 (Unix) OpenSSL/1.1.1k System : Linux hwsrv-1277026.hostwindsdns.com 4.18.0-477.13.1.el8_8.x86_64 #1 SMP Tue May 30 14:53:41 EDT 2023 x86_64 User : viralblo ( 1001) PHP Version : 8.1.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /lib/python3.6/site-packages/cloudinit/config/__pycache__/ |
Upload File : |
3
��b� � @ s� U d Z ddlZddlZddlZddlmZ ddlmZmZ ddl m
Z
mZ ddlm
Z
ddlmZ ejd�Zejd �Zejd
�Zejd�Zejd�Zejd
�Zejd�ZddiZeje�ZdZdddee
geed�gd�Ze
ee�Z dd� Zdd� Zdd� Z dSdd�Z!dTd d!�Z"d"d#� Z#dUd$d%�Z$d&d'� Z%d(d)� Z&dVd+d,�Z'd-d.� Z(d/d0� Z)d1d2� Z*d3d4� Z+d5d6� Z,d7d8� Z-d9d:� Z.d;d<� Z/d=d>� Z0d?d@� Z1dAdB� Z2dCdD� Z3dEdF� Z4dGdH� Z5dIdJ� Z6dKdL� Z7dMdN� Z8dOdP� Z9dQdR� Z:dS )Wz1Disk Setup: Configure partitions and filesystems.� N)�dedent)�subp�util)�
MetaSchema�get_meta_doc)�ALL_DISTROS)�PER_INSTANCEZsfdiskZsgdiskZlsblkZblkidZblockdevZ partprobeZwipefsZLANG�Ca� This module is able to configure simple partition tables and filesystems.
.. note::
for more detail about configuration options for disk setup, see the disk
setup example
For convenience, aliases can be specified for disks using the
``device_aliases`` config key, which takes a dictionary of alias: path
mappings. There are automatic aliases for ``swap`` and ``ephemeral<X>``, where
``swap`` will always refer to the active swap partition and ``ephemeral<X>``
will refer to the block device of the ephemeral image.
Disk partitioning is done using the ``disk_setup`` directive. This config
directive accepts a dictionary where each key is either a path to a block
device or an alias specified in ``device_aliases``, and each value is the
configuration options for the device. File system configuration is done using
the ``fs_setup`` directive. This config directive accepts a list of
filesystem configs.
Z
cc_disk_setupz
Disk Setupz$Configure partitions and filesystemsaD device_aliases:
my_alias: /dev/sdb
disk_setup:
my_alias:
table_type: gpt
layout: [50, 50]
overwrite: true
fs_setup:
- label: fs1
filesystem: ext4
device: my_alias.1
cmd: mkfs -t %(filesystem)s -L %(label)s %(device)s
- label: fs2
device: my_alias.2
filesystem: ext4
mounts:
- ["my_alias.1", "/mnt1"]
- ["my_alias.2", "/mnt2"]
)�id�name�title�descriptionZdistrosZ frequencyZexamplesc s� |j di ��� �fdd�}|j d�}t|t�r�t||� |jdt|�� x�|j� D ]�\}}t|t�st|jd| � qRy*|jd� tj t
jd| t||fd � W qR tk
r� } ztj
t
d
| � W Y dd} ~ X qRX qRW |j d�}
t|
t��r�|jd
t|
�� t|
|� x�|
D ]�}t|t��s.|jd| � �qy2|jd� |j d�}tj t
jd| t|fd � W n4 tk
�r� } ztj
t
d| � W Y dd} ~ X nX �qW dS )z[
See doc/examples/cloud-config-disk-setup.txt for documentation on the
format.
�device_aliasesc s �j | �}� j|p| �p|S )N)�getZdevice_name_to_device)Zcandr )�cloudr � �#/usr/lib/python3.6/cc_disk_setup.py�alias_to_device` s
zhandle.<locals>.alias_to_device�
disk_setupzPartitioning disks: %szInvalid disk definition for %sz!Creating new partition table/diskzCreating partition on %s)Zlogfunc�msg�func�argsz Failed partitioning operation
%sN�fs_setupzsetting up filesystems: %sz"Invalid file system definition: %szCreating new filesystem.�devicezCreating fs for %sz%Failed during filesystem operation
%s)r �
isinstance�dict�update_disk_setup_devices�debug�str�items�warningr Zlog_time�LOG�mkpart� Exception�logexc�list�update_fs_setup_devices�mkfs)�_nameZcfgr �logZ_argsr r �disk�
definition�er r r )r r r �handleY sJ
&
r- c C s� x�t | �D ]t}||�}|d ks
||kr(q
|| krDtjd||� | |= | | | |<