HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.104.1.lve.el8.x86_64 #1 SMP Tue Feb 10 20:07:30 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.29
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/ceph.cpython-310.pyc
o

�N�gD?�@sXdZddlZe�e�ZdZzddlZdZWney dZYnwdd�Z	dd	�Z
d
d�Zdd
�Zdd�Z
dd�ZdJdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Z d6d7�Z!d8d9�Z"d:d;�Z#d<d=�Z$d>d?�Z%d@dA�Z&dBdC�Z'dDdE�Z(dFdG�Z)dHdI�Z*dS)Kzn
Module to provide ceph control with salt.

:depends:   - ceph_cfg Python module

.. versionadded:: 2016.11.0
�NZcephTFcCstdur
d�t�}d|fStS)NFz9ceph_cfg unavailable: {} execution module cant be loaded )�HAS_CEPH_CFG�format�__virtualname__)�msg�r�E/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/ceph.py�__virtual__s�rcC�t��S)zs
    List partitions by disk

    CLI Example:

    .. code-block:: bash

        salt '*' ceph.partition_list
    )�ceph_cfg�partition_listrrrrr �
rcCr	)z�
    List all OSD data partitions by partition

    CLI Example:

    .. code-block:: bash

        salt '*' ceph.partition_list_osd
    )r
�partition_list_osdrrrrr
-rr
cCr	)z�
    List all OSD journal partitions by partition

    CLI Example:

    .. code-block:: bash

        salt '*' ceph.partition_list_journal
    )r
�partition_list_journalrrrrr:rrcCr	)zr
    List all OSD by cluster

    CLI Example:

    .. code-block:: bash

        salt '*' ceph.osd_discover

    )r
�osd_discoverrrrrrGsrcCs
t�|�S)z�
    Check whether a given device path is a partition or a full disk.

    CLI Example:

    .. code-block:: bash

        salt '*' ceph.partition_is /dev/sdc1
    )r
�partition_is)�devrrrrUs

rcKs6|dur	t�d�|�d|�}||d<tjdi|��S)a�
    Destroy the partition table and content of a given disk.

    .. code-block:: bash

        salt '*' ceph.osd_prepare 'dev'='/dev/vdc' \
                'cluster_name'='ceph' \
                'cluster_uuid'='cluster_uuid'

    dev
        The block device to format.

    cluster_name
        The cluster name. Defaults to ``ceph``.

    cluster_uuid
        The cluster UUID. Defaults to value found in ceph config file.
    Nz&Deprecated use of function, use kwargsrr)�log�warning�getr
�zap)�target�kwargsrrrrbs

rcK�tjdi|��S)a
    Prepare an OSD

    CLI Example:

    .. code-block:: bash

        salt '*' ceph.osd_prepare 'osd_dev'='/dev/vdc' \
                'journal_dev'='device' \
                'cluster_name'='ceph' \
                'cluster_uuid'='cluster_uuid' \
                'osd_fs_type'='xfs' \
                'osd_uuid'='2a143b73-6d85-4389-a9e9-b8a78d9e1e07' \
                'journal_uuid'='4562a5db-ff6f-4268-811d-12fd4a09ae98'

    cluster_uuid
        The device to store the osd data on.

    journal_dev
        The journal device. defaults to osd_dev.

    cluster_name
        The cluster name. Defaults to ``ceph``.

    cluster_uuid
        The cluster date will be added too. Defaults to the value found in local config.

    osd_fs_type
        set the file system to store OSD data with. Defaults to "xfs".

    osd_uuid
        set the OSD data UUID. If set will return if OSD with data UUID already exists.

    journal_uuid
        set the OSD journal UUID. If set will return if OSD with journal UUID already exists.
    Nr)r
�osd_prepare�rrrrr|s%rcKr)z~
    Activate an OSD

    CLI Example:

    .. code-block:: bash

        salt '*' ceph.osd_activate 'osd_dev'='/dev/vdc'
    Nr)r
�osd_activaterrrrr�s
rcKr)a�
    Create keyring for cluster

    CLI Example:

    .. code-block:: bash

        salt '*' ceph.keyring_create \
                'keyring_type'='admin' \
                'cluster_name'='ceph' \
                'cluster_uuid'='cluster_uuid'

    keyring_type (required)
        One of ``admin``, ``mon``, ``osd``, ``rgw``, ``mds``

    cluster_uuid
        The cluster UUID. Defaults to value found in ceph config file.

    cluster_name
        The cluster name. Defaults to ``ceph``.
    Nr)r
�keyring_createrrrrr��rcKr)a�
    Create save keyring locally

    CLI Example:

    .. code-block:: bash

        salt '*' ceph.keyring_save \
                'keyring_type'='admin' \
                'cluster_name'='ceph' \
                'cluster_uuid'='cluster_uuid'

    keyring_type (required)
        One of ``admin``, ``mon``, ``osd``, ``rgw``, ``mds``

    cluster_uuid
        The cluster UUID. Defaults to value found in ceph config file.

    cluster_name
        The cluster name. Defaults to ``ceph``.
    Nr)r
�keyring_saverrrrr�rrcKr)a)
    Delete keyring for cluster

    CLI Example:

    .. code-block:: bash

        salt '*' ceph.keyring_purge \
                'keyring_type'='admin' \
                'cluster_name'='ceph' \
                'cluster_uuid'='cluster_uuid'

    keyring_type (required)
        One of ``admin``, ``mon``, ``osd``, ``rgw``, ``mds``

    cluster_uuid
        The cluster UUID. Defaults to value found in ceph config file.

    cluster_name
        The cluster name. Defaults to ``ceph``.

    If no ceph config file is found, this command will fail.
    Nr)r
�
keyring_purgerrrrr�srcKr)a
    Returns ``True`` if the keyring is present on disk, otherwise ``False``

    CLI Example:

    .. code-block:: bash

        salt '*' ceph.keyring_present \
                'keyring_type'='admin' \
                'cluster_name'='ceph' \
                'cluster_uuid'='cluster_uuid'

    keyring_type (required)
        One of ``admin``, ``mon``, ``osd``, ``rgw``, ``mds``

    cluster_uuid
        The cluster UUID. Defaults to value found in ceph config file.

    cluster_name
        The cluster name. Defaults to ``ceph``.
    Nr)r
�keyring_presentrrrrr �rr cKr)a�
    Add keyring to authorized list

    CLI Example:

    .. code-block:: bash

        salt '*' ceph.keyring_auth_add \
                'keyring_type'='admin' \
                'cluster_name'='ceph' \
                'cluster_uuid'='cluster_uuid'

    keyring_type (required)
        One of ``admin``, ``mon``, ``osd``, ``rgw``, ``mds``

    cluster_uuid
        The cluster UUID. Defaults to value found in ceph config file.

    cluster_name
        The cluster name. Defaults to ``ceph``.
    Nr)r
�keyring_auth_addrrrrr!rr!cKr)a�
    Remove keyring from authorised list

    CLI Example:

    .. code-block:: bash

        salt '*' ceph.keyring_osd_auth_del \
                'keyring_type'='admin' \
                'cluster_name'='ceph' \
                'cluster_uuid'='cluster_uuid'

    keyring_type (required)
        One of ``admin``, ``mon``, ``osd``, ``rgw``, ``mds``

    cluster_uuid
        The cluster UUID. Defaults to value found in ceph config file.

    cluster_name
        The cluster name. Defaults to ``ceph``.
    Nr)r
�keyring_auth_delrrrrr"0rr"cKr)a�
    Returns ``True`` if the target is a mon node, otherwise ``False``

    CLI Example:

    .. code-block:: bash

        salt '*' ceph.mon_is \
                'cluster_name'='ceph' \
                'cluster_uuid'='cluster_uuid'

    cluster_name
        The cluster name. Defaults to ``ceph``.

    cluster_uuid
        The cluster UUID. Defaults to value found in ceph config file.
    Nr)r
�mon_isrrrrr#I�r#cKr)ae
    Get status from mon daemon

    CLI Example:

    .. code-block:: bash

        salt '*' ceph.mon_status \
                'cluster_name'='ceph' \
                'cluster_uuid'='cluster_uuid'

    cluster_uuid
        The cluster UUID. Defaults to value found in ceph config file.

    cluster_name
        The cluster name. Defaults to ``ceph``.
    Nr)r
�statusrrrr�
mon_status^r$r&cKr)a�
    Returns ``True`` if the mon daemon is in the quorum, otherwise ``False``

    CLI Example:

    .. code-block:: bash

        salt '*' ceph.mon_quorum \
                'cluster_name'='ceph' \
                'cluster_uuid'='cluster_uuid'

    cluster_uuid
        The cluster UUID. Defaults to value found in ceph config file.

    cluster_name
        The cluster name. Defaults to ``ceph``.
    Nr)r
�
mon_quorumrrrrr'sr$r'cKr)a�
    Returns ``True`` if the mon daemon is running, otherwise ``False``

    CLI Example:

    .. code-block:: bash

        salt '*' ceph.mon_active \
                'cluster_name'='ceph' \
                'cluster_uuid'='cluster_uuid'

    cluster_uuid
        The cluster UUID. Defaults to value found in ceph config file.

    cluster_name
        The cluster name. Defaults to ``ceph``.
    Nr)r
�
mon_activerrrrr(�r$r(cKr)a\
    Create a mon node

    CLI Example:

    .. code-block:: bash

        salt '*' ceph.mon_create \
                'cluster_name'='ceph' \
                'cluster_uuid'='cluster_uuid'

    cluster_uuid
        The cluster UUID. Defaults to value found in ceph config file.

    cluster_name
        The cluster name. Defaults to ``ceph``.
    Nr)r
�
mon_createrrrrr)�r$r)cKr)a

    Create pools for rgw

    CLI Example:

    .. code-block:: bash

        salt '*' ceph.rgw_pools_create

    cluster_uuid
        The cluster UUID. Defaults to value found in ceph config file.

    cluster_name
        The cluster name. Defaults to ``ceph``.
    Nr)r
�rgw_pools_createrrrrr*��r*cKr)a
    Show pools missing for rgw

    CLI Example:

    .. code-block:: bash

        salt '*' ceph.rgw_pools_missing

    cluster_uuid
        The cluster UUID. Defaults to value found in ceph config file.

    cluster_name
        The cluster name. Defaults to ``ceph``.
    Nr)r
�rgw_pools_missingrrrrr,�r+r,cKr)a�
    Create a rgw

    CLI Example:

    .. code-block:: bash

        salt '*' ceph.rgw_create \
                'name' = 'rgw.name' \
                'cluster_name'='ceph' \
                'cluster_uuid'='cluster_uuid'

    name (required)
        The RGW client name. Must start with ``rgw.``

    cluster_uuid
        The cluster UUID. Defaults to value found in ceph config file.

    cluster_name
        The cluster name. Defaults to ``ceph``.
    Nr)r
�
rgw_createrrrrr-�rr-cKr)a�
    Remove a rgw

    CLI Example:

    .. code-block:: bash

        salt '*' ceph.rgw_destroy \
                'name' = 'rgw.name' \
                'cluster_name'='ceph' \
                'cluster_uuid'='cluster_uuid'

    name (required)
        The RGW client name (must start with ``rgw.``)

    cluster_uuid
        The cluster UUID. Defaults to value found in ceph config file.

    cluster_name
        The cluster name. Defaults to ``ceph``.
    Nr)r
�rgw_destroyrrrrr.�rr.cKr)a�
    Create a mds

    CLI Example:

    .. code-block:: bash

        salt '*' ceph.mds_create \
                'name' = 'mds.name' \
                'port' = 1000, \
                'addr' = 'fqdn.example.org' \
                'cluster_name'='ceph' \
                'cluster_uuid'='cluster_uuid'

    name (required)
        The MDS name (must start with ``mds.``)

    port (required)
        Port to which the MDS will listen

    addr (required)
        Address or IP address for the MDS to listen

    cluster_uuid
        The cluster UUID. Defaults to value found in ceph config file.

    cluster_name
        The cluster name. Defaults to ``ceph``.
    Nr)r
�
mds_createrrrrr/
sr/cKr)a�
    Remove a mds

    CLI Example:

    .. code-block:: bash

        salt '*' ceph.mds_destroy \
                'name' = 'mds.name' \
                'cluster_name'='ceph' \
                'cluster_uuid'='cluster_uuid'

    name (required)
        The MDS name (must start with ``mds.``)

    cluster_uuid
        The cluster UUID. Defaults to value found in ceph config file.

    cluster_name
        The cluster name. Defaults to ``ceph``.
    Nr)r
�mds_destroyrrrrr0+rr0cKr)as
    List all cephx authorization keys

    CLI Example:

    .. code-block:: bash

        salt '*' ceph.keyring_auth_list \
                'cluster_name'='ceph' \
                'cluster_uuid'='cluster_uuid'

    cluster_name
        The cluster name. Defaults to ``ceph``.

    cluster_uuid
        The cluster UUID. Defaults to value found in ceph config file.
    Nr)r
�keyring_auth_listrrrrr1Dr$r1cKr)aX
    List all pools

    CLI Example:

    .. code-block:: bash

        salt '*' ceph.pool_list \
                'cluster_name'='ceph' \
                'cluster_uuid'='cluster_uuid'

    cluster_name
        The cluster name. Defaults to ``ceph``.

    cluster_uuid
        The cluster UUID. Defaults to value found in ceph config file.
    Nr)r
�	pool_listrrrrr2Yr$r2cK�tj|fi|��S)aX
    Create a pool

    CLI Example:

    .. code-block:: bash

        salt '*' ceph.pool_add pool_name \
                'cluster_name'='ceph' \
                'cluster_uuid'='cluster_uuid'

    cluster_name
        The cluster name. Defaults to ``ceph``.

    cluster_uuid
        The cluster UUID. Defaults to value found in ceph config file.

    pg_num
        Default to 8

    pgp_num
        Default to pg_num

    pool_type
        can take values "replicated" or "erasure"

    erasure_code_profile
        The "erasure_code_profile"

    crush_ruleset
        The crush map rule set
    )r
�pool_add�Z	pool_namerrrrr4ns!r4cKr3)a`
    Delete a pool

    CLI Example:

    .. code-block:: bash

        salt '*' ceph.pool_del pool_name \
                'cluster_name'='ceph' \
                'cluster_uuid'='cluster_uuid'

    cluster_name
        The cluster name. Defaults to ``ceph``.

    cluster_uuid
        The cluster UUID. Defaults to value found in ceph config file.
    )r
�pool_delr5rrrr6�sr6cKr)aj
    purge ceph configuration on the node

    CLI Example:

    .. code-block:: bash

        salt '*' ceph.purge \
                'cluster_name'='ceph' \
                'cluster_uuid'='cluster_uuid'

    cluster_name
        The cluster name. Defaults to ``ceph``.

    cluster_uuid
        The cluster UUID. Defaults to value found in ceph config file.
    Nr)r
�purgerrrrr7�r$r7cCr	)z{
    Get the version of ceph installed

    CLI Example:

    .. code-block:: bash

        salt '*' ceph.ceph_version
    )r
�ceph_versionrrrrr8�rr8cKr)an
    Get the cluster's quorum status

    CLI Example:

    .. code-block:: bash

        salt '*' ceph.cluster_quorum \
                'cluster_name'='ceph' \
                'cluster_uuid'='cluster_uuid'

    cluster_uuid
        The cluster UUID. Defaults to value found in ceph config file.

    cluster_name
        The cluster name. Defaults to ``ceph``.
    Nr)r
�cluster_quorumrrrrr9�r$r9cKr)a�
    Get the cluster status, including health if in quorum

    CLI Example:

    .. code-block:: bash

        salt '*' ceph.cluster_status \
                'cluster_name'='ceph' \
                'cluster_uuid'='cluster_uuid'

    cluster_uuid
        The cluster UUID. Defaults to value found in ceph config file.

    cluster_name
        The cluster name. Defaults to ``ceph``.
    Nr)r
�cluster_statusrrrrr:�r$r:)N)+�__doc__�logging�	getLogger�__name__rrr
r�ImportErrorrrr
rrrrrrrrrr r!r"r#r&r'r(r)r*r,r-r.r/r0r1r2r4r6r7r8r9r:rrrr�<module>sX
�	




(
!$