File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/states/__pycache__/zpool.cpython-310.pyc
Back
o ;jp5 � @ sZ d Z ddlZddlZddlmZ e�e�ZdZdd� Z ddd�Z dd d �Zddd �ZdS )a# States for managing zpools :maintainer: Jorge Schrauwen <sjorge@blackdot.be> :maturity: new :depends: salt.utils.zfs, salt.modules.zpool :platform: smartos, illumos, solaris, freebsd, linux .. versionadded:: 2016.3.0 .. versionchanged:: 2018.3.1 Big refactor to remove duplicate code, better type conversions and improved consistency in output. .. code-block:: yaml oldpool: zpool.absent: - export: true newpool: zpool.present: - config: import: false force: true - properties: comment: salty storage pool - layout: - mirror: - /dev/disk0 - /dev/disk1 - mirror: - /dev/disk2 - /dev/disk3 partitionpool: zpool.present: - config: import: false force: true - properties: comment: disk partition salty storage pool ashift: '12' feature@lz4_compress: enabled - filesystem_properties: compression: lz4 atime: on relatime: on - layout: - /dev/disk/by-uuid/3e43ce94-77af-4f52-a91b-6cdbb0b0f41b simplepool: zpool.present: - config: import: false force: true - properties: comment: another salty storage pool - layout: - /dev/disk0 - /dev/disk1 .. warning:: The layout will never be updated, it will only be used at time of creation. It's a whole lot of work to figure out if a devices needs to be detached, removed, etc. This is best done by the sysadmin on a case per case basis. Filesystem properties are also not updated, this should be managed by the zfs state module. � N)�OrderedDictZzpoolc C s t �d�sdS tS )z Provides zpool state Zzfs_support)Fz3The zpool state cannot be loaded: zfs not supported)� __grains__�get�__virtualname__� r r �E/opt/saltstack/salt/lib/python3.10/site-packages/salt/states/zpool.py�__virtual__R s r c C s g }|rt j�|�sd}t| t�r:| D ]$}t|t�r#|�t||�� q|r2|d dkr2t j�||�}|� |� q|S t| t�r}| D ]9}|� d�d }| | }|dkrW|� |� t|t�sa|� d�}|D ]}|rt|d dkrtt j�||�}|� |� qcqA|S d}|S )a� Turn the layout data into usable vdevs spedcification We need to support 2 ways of passing the layout: .. code:: layout_new: - mirror: - disk0 - disk1 - mirror: - disk2 - disk3 .. code: layout_legacy: mirror-0: disk0 disk1 mirror-1: disk2 disk3 Nr �/�-�disk� )�os�path�exists� isinstance�listr �extend�_layout_to_vdev�join�append�split)�layout� device_dir�vdevsZvdevZ vdev_typeZ vdev_diskr r r r r [ s6 � � �r c C s� | i ddd�}ddddd�}t d dkrd |d <