File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/bcache.cpython-310.pyc
o
�N�g�r � @ sz d Z ddlZddlZddlZddlZddlZe�e�Z ej
ejejej
ejejd�Zdddd�Zejj�d�duZd d
� ZdEdd�ZdEd
d�ZdEdd�Zdd� ZdEdd�ZdFdd�Z dGdd�ZdEdd�ZdHdd�ZdId d!�Z d"d#� Z!d$d%� Z"d&d'� Z#d(d)� Z$dEd*d+�Z%d,d-� Z&d.d/� Z'dJd0d1�Z(dJd2d3�Z)dJd4d5�Z* dKd6d7�Z+d8d9� Z,d:d;� Z-d<d=� Z.dLd?d@�Z/dMdAdB�Z0dCdD� Z1dS )Na�
Module for managing BCache sets
BCache is a block-level caching mechanism similar to ZFS L2ARC/ZIL, dm-cache and fscache.
It works by formatting one block device as a cache set, then adding backend devices
(which need to be formatted as such) to the set and activating them.
It's available in Linux mainline kernel since 3.10
https://www.kernel.org/doc/Documentation/bcache.txt
This module needs the bcache userspace tools to function.
.. versionadded:: 2016.3.0
� N)Ztrace�debug�info�warn�errorZcrit�attach�config�super)�attach_�config_�super_�
blkdiscardc C s t jj�d�duS )z1
Only work when make-bcache is installed
zmake-bcacheN)�salt�utils�path�which� r r �G/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/bcache.py�__virtual__- � r c C sR z| du rt tjj�d��d d d W S tj�t| d��W S ty( Y dS w )a
Return the bcache UUID of a block device.
If no device is given, the Cache UUID is returned.
CLI Example:
.. code-block:: bash
salt '*' bcache.uuid
salt '*' bcache.uuid /dev/sda
salt '*' bcache.uuid bcache0
N�/sys/fs/bcache/r � �cacheF) �listr
r r �os_walk�os�basename�_bcsys� Exception��devr r r �uuid4 s �r c s� t � � � s
t�d�� dS �du r/i }tdd��� D ]\�}d|v r(t��|�<