HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.30
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/zpool.cpython-310.pyc
o

�N�g��@s^dZddlZddlZddlZddlZddlZddlmZe�	e
�ZdZddd�Z
dd	�Zd
d�Zdd
�ZdEdd�ZdFdd�ZdGdd�ZdHdd�Zdd�Zdd�ZdIdd�ZdJd d!�Zd"d#�Zd$d%�ZdId&d'�Zd(d)�Zd*d+�ZdKd,d-�Zejj j!�"d.�d/d0��Z#d1d2�Z$dLd3d4�Z%d5d6�Z&d7d8�Z'dId9d:�Z(dEd;d<�Z)d=d>�Z*d?d@�Z+dLdAdB�Z,dMdCdD�Z-dS)Na�
Module for running ZFS zpool command

:codeauthor:    Nitin Madhok <nmadhok@g.clemson.edu>, Jorge Schrauwen <sjorge@blackdot.be>
:maintainer:    Jorge Schrauwen <sjorge@blackdot.be>
:maturity:      new
:depends:       salt.utils.zfs
:platform:      illumos,freebsd,linux

.. versionchanged:: 2018.3.1
  Big refactor to remove duplicate code, better type conversions and improved
  consistency in output.

�N)�OrderedDict�zpool�import�list)�import_�list_cCst�d�rtSdS)z5
    Only load when the platform has zfs support
    Zzfs_support)Fz4The zpool module cannot be loaded: zfs not supported)Z
__grains__�get�__virtualname__�r
r
�F/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/zpool.py�__virtual__!s
rcCs�t�}|��D]Z\}}|dvrat|�}|r%t|t�r%|�t||fg��q|r1t|t�r1|||<qt|t�r<|�|�qt|t�r^g}|��D]\}}|�t||fg��qG|�|�|}q|g}q|S)zE
    Return a simple vdev tree from zpool.status' config section
    )�state�read�writeZcksum)r�items�_clean_vdev_config�
isinstancer�append)�configZ
cln_configZlabelZ
sub_configZ
new_configZ	old_labelZ
old_configr
r
rr+s&



�rcCs*tdtdddgd�dd�}|dd	kS)
z�
    Check if all zpools are healthy

    .. versionadded:: 2016.3.0

    CLI Example:

    .. code-block:: bash

        salt '*' zpool.healthy

    �cmd.run_all�zfs.zpool_command�statusz-x)�flagsF��python_shell�stdoutzall pools are healthy��__salt__�	__utils__)�resr
r
r�healthyFs
�r c
Csbt�}tdtdd|d�dd�}|ddkrtd	|�Sd
}d
}|d��D]T}|��dkr0q'd
|vrm|ddkrm|�d
�d��}d
�|�d
�dd
����}|dkr`||kr`|}t�||<|dkrj||||<|}q'd�||||�|||<q'|D]�}d||vr�q~d
}	d
}
d
}d
}d
}
||d}t�}|��D]�}|	s�|����}	dd�|	�d�D�}	q�|ddkr�|dd
�}tt	t
|	dd�|���d�D����}td|�}|�d�r�|d}
|||
|||
<n8|�d��rd
}
|d}|||
||<n#|�d��rd
}
}|d}|||
|<nd
}
}}|d}
|||
<|d=q�|||d<q~|S)z�
    Return the status of the named zpool

    zpool : string
        optional name of storage pool

    .. versionadded:: 2016.3.0

    CLI Example:

    .. code-block:: bash

        salt '*' zpool.status myzpool

    rrr)�targetFr�retcoder�zfs.parse_command_resultNr��:�	��poolz{}
{}rcS�g|]}|dvr|�qS�)r$r
��.0�xr
r
r�
<listcomp>��zstatus.<locals>.<listcomp>� cSr)r*r
r+r
r
rr.�r/�zfs.from_auto_dictz      �name�    �  )rrr�
splitlines�strip�split�join�format�lowerr�zip�
startswith)r�retrZcurrent_poolZcurrent_propZzpd�prop�valuer(�header�	root_vdev�vdev�devZrdevrZconfig_data�lineZ	stat_datar
r
rr_s��
����

r�Tc	Csft�}tdtdddg||dgd�dd�}|d	d
kr"td|�Sgd�}d
}d
}d
}t�}	|d��D]{}
|
��dksG|
����ddvrHq5|
�d�r[|
�d�r[|�|	�t�}	q5tt	t
|dd�|
���d�D����}|rwtd|�}ntd|�}|
�d�r�|d}||	|||<n|
�d�r�d
}|d}||	||<nd
}}|d}||	|<|d=q5|S)a
    Display I/O statistics for the given pools

    zpool : string
        optional name of storage pool

    sample_time : int
        seconds to capture data before output
        default a sample of 5 seconds is used
    parsable : boolean
        display data in pythonc values (True, False, Bytes,...)

    .. versionadded:: 2016.3.0
    .. versionchanged:: 2018.3.1

        Added ```parsable``` parameter that defaults to True

    CLI Example:

    .. code-block:: bash

        salt '*' zpool.iostat myzpool

    rr�iostatz-v���commandrr!Frr"rr#)r2zcapacity-allocz
capacity-freezoperations-readzoperations-writezbandwidth-readzbandwidth-writeNrr$���)rZ	bandwidth�-cSr)r*r
r+r
r
rr.>r/ziostat.<locals>.<listcomp>r0r1�zfs.to_auto_dictr3r2r4)rrrr5r6r7r<�endswith�updaterr;)rZsample_time�parsabler=rr@rArBrCZcurrent_datarDZio_datar
r
rrF�sX��	 
���


rF�size,alloc,free,cap,frag,healthcCst�}t|t�s
|�d�}d|vr|�d�d|vs|�dd�td�s2d|vr2|�d�d|vs)tdtddd	gd
d�|�i|d�dd
�}|ddkrTtd|�S|d�	�D],}ttt
||���d����}|rstd|�}ntd|�}|||d<||dd=qZ|S)a!
    .. versionadded:: 2015.5.0

    Return information about (all) storage pools

    zpool : string
        optional name of storage pool

    properties : string
        comma-separated list of properties to list

    parsable : boolean
        display numbers in parsable (exact) values

        .. versionadded:: 2018.3.0

    .. note::

        The ``name`` property will always be included, while the ``frag``
        property will get removed if not available

    zpool : string
        optional zpool

    .. note::

        Multiple storage pool can be provided as a space separated list

    CLI Example:

    .. code-block:: bash

        salt '*' zpool.list
        salt '*' zpool.list zpool=tank
        salt '*' zpool.list 'size,free'
        salt '*' zpool.list 'size,free' tank

    �,r2r�zfs.has_feature_flags�fragrrr�-H�-o�rIr�optsr!Frr"r#rr&r1rL)rrrr7�remove�insertrrr8r5r;r6)�
propertiesrrOr=rrDZ
zpool_datar
r
rr^sJ'


�

���
���
rFc		Cs�t�}gd�}tdtdddg|r|nd|d�dd	�}|d
dkr(td|�S|d
��D]M}ttt|dd�|���d�D����}|d=|rVtd|d|d�|d<n
td|d|d�|d<|rs|||d<||dd=q.|d||d<q.|S)a�
    .. versionadded:: 2016.3.0

    Retrieves the given list of properties

    zpool : string
        Name of storage pool

    prop : string
        Optional name of property to retrieve

    show_source : boolean
        Show source of property

    parsable : boolean
        Display numbers in parsable (exact) values

        .. versionadded:: 2018.3.0

    CLI Example:

    .. code-block:: bash

        salt '*' zpool.get myzpool

    )r2�propertyr?�sourcerrrrT�all)rIr�
property_namer!Frr"rr#rcSr)r*r
r+r
r
rr.�r/zget.<locals>.<listcomp>r&r2z
zfs.from_autor[r?zzfs.to_auto)rrrr5rr;r6r7)	rr>Zshow_sourcerOr=Zvalue_propertiesrrDZ	prop_datar
r
rr�sF
��
���

��rcCs4t�}tdtdd|||d�dd�}td|d�S)a]
    Sets the given property on the specified pool

    zpool : string
        Name of storage pool

    prop : string
        Name of property to set

    value : string
        Value to set for the specified property

    .. versionadded:: 2016.3.0

    CLI Example:

    .. code-block:: bash

        salt '*' zpool.set myzpool readonly yes

    rr�set)rIr^Zproperty_valuer!Frr#)rrr)rr>r?r=rr
r
rr_s��
r_cCs*tdtdd|d�ddd�}|dd	kS)
z�
    Check if a ZFS storage pool is active

    zpool : string
        Name of storage pool

    CLI Example:

    .. code-block:: bash

        salt '*' zpool.exists myzpool

    rrr�rIr!FT)rZignore_retcoder"rr�rrr
r
r�existsBs��	rbcC�6tdtdd|rdgnd|d�dd�}td	|d
�S)z�
    Destroys a storage pool

    zpool : string
        Name of storage pool

    force : boolean
        Force destroy of pool

    CLI Example:

    .. code-block:: bash

        salt '*' zpool.destroy myzpool

    rr�destroy�-fNrHFrr#Z	destroyedr)r�forcerr
r
rrd^s��	rdcCsz|rdg}n|rdg}nd}tdtdd||d�dd	�}|d
dkr*td|d
�St�}|s1|r7d|d
<|Sd|d
<|S)a�
    Scrub a storage pool

    zpool : string
        Name of storage pool

    stop : boolean
        If ``True``, cancel ongoing scrub

    pause : boolean
        If ``True``, pause ongoing scrub

        .. versionadded:: 2018.3.0

        .. note::

            Pause is only available on recent versions of ZFS.

            If both ``pause`` and ``stop`` are ``True``, then ``stop`` will
            win.

    CLI Example:

    .. code-block:: bash

        salt '*' zpool.scrub myzpool

    z-sz-pNrr�scrubrHFrr"rr#Z	scrubbingT)rrr)r�stop�pause�actionrr=r
r
rrg|s*��	�rgc
	Osg}i}g}|�di�}|�di�}|�dd�r|�d�|�dd�s'd|vr,|�d�|�d	d�r9|�d	�|d
<|�dd�rF|�d�|d<|�|�|�|�td
tdd|||||d�dd�}td|d�}	|	dr~ttd|d�|d|�|	d<|	S)a[
    .. versionadded:: 2015.5.0

    Create a simple zpool, a mirrored zpool, a zpool having nested VDEVs, a hybrid zpool with cache, spare and log drives or a zpool with RAIDZ-1, RAIDZ-2 or RAIDZ-3

    zpool : string
        Name of storage pool

    vdevs : string
        One or move devices

    force : boolean
        Forces use of vdevs, even if they appear in use or specify a
        conflicting replication level.

    mountpoint : string
        Sets the mount point for the root dataset

    altroot : string
        Equivalent to "-o cachefile=none,altroot=root"

    properties : dict
        Additional pool properties

    filesystem_properties : dict
        Additional filesystem properties

    createboot : boolean
        create a boot partition

        .. versionadded:: 2018.3.0

        .. warning:
          This is only available on illumos and Solaris

    CLI Examples:

    .. code-block:: bash

        salt '*' zpool.create myzpool /path/to/vdev1 [...] [force=True|False]
        salt '*' zpool.create myzpool mirror /path/to/vdev1 /path/to/vdev2 [...] [force=True|False]
        salt '*' zpool.create myzpool raidz1 /path/to/vdev1 /path/to/vdev2 raidz2 /path/to/vdev3 /path/to/vdev4 /path/to/vdev5 [...] [force=True|False]
        salt '*' zpool.create myzpool mirror /path/to/vdev1 [...] mirror /path/to/vdev2 /path/to/vdev3 [...] [force=True|False]
        salt '*' zpool.create myhybridzpool mirror /tmp/file1 [...] log mirror /path/to/vdev1 [...] cache /path/to/vdev2 [...] spare /path/to/vdev3 [...] [force=True|False]

    .. note::

        Zpool properties can be specified at the time of creation of the pool
        by passing an additional argument called "properties" and specifying
        the properties with their respective values in the form of a python
        dictionary:

        .. code-block:: text

            properties="{'property1': 'value1', 'property2': 'value2'}"

        Filesystem properties can be specified at the time of creation of the
        pool by passing an additional argument called "filesystem_properties"
        and specifying the properties with their respective values in the form
        of a python dictionary:

        .. code-block:: text

            filesystem_properties="{'property1': 'value1', 'property2': 'value2'}"

        Example:

        .. code-block:: bash

            salt '*' zpool.create myzpool /path/to/vdev1 [...] properties="{'property1': 'value1', 'property2': 'value2'}"

    CLI Example:

    .. code-block:: bash

        salt '*' zpool.create myzpool /path/to/vdev1 [...] [force=True|False]
        salt '*' zpool.create myzpool mirror /path/to/vdev1 /path/to/vdev2 [...] [force=True|False]
        salt '*' zpool.create myzpool raidz1 /path/to/vdev1 /path/to/vdev2 raidz2 /path/to/vdev3 /path/to/vdev4 /path/to/vdev5 [...] [force=True|False]
        salt '*' zpool.create myzpool mirror /path/to/vdev1 [...] mirror /path/to/vdev2 /path/to/vdev3 [...] [force=True|False]
        salt '*' zpool.create myhybridzpool mirror /tmp/file1 [...] log mirror /path/to/vdev1 [...] cache /path/to/vdev2 [...] spare /path/to/vdev3 [...] [force=True|False]

    rZ�filesystem_propertiesrfFreZ
createbootZbootsizez-B�altroot�-RZ
mountpoint�-mrr�create)rIrrW�pool_propertiesrkr!rr#�created�zpool.status�rr�vdevs�rr�extendrrr)
rrt�kwargsrrWr!rprkrr=r
r
rro�s@U



���rocOs�g}g}|�dd�r|�d�|�|�|�|�tdtdd||d�dd�}td	|d
�}|d
rDttd|d�|d
|�|d<|S)aD
    Add the specified vdev's to the given storage pool

    zpool : string
        Name of storage pool

    vdevs : string
        One or more devices

    force : boolean
        Forces use of device

    CLI Example:

    .. code-block:: bash

        salt '*' zpool.add myzpool /path/to/vdev1 /path/to/vdev2 [...]

    rfFrerr�addrHrr#Zaddedrrrsrrtru)rrtrwrr!rr=r
r
rrx8s(


��	�rxcCs�g}g}|r|�d�|�|�|�|�|�|�tdtdd||d�dd�}td|d	�}|d	rEttd
|d�|d|�|d
<|S)a�
    Attach specified device to zpool

    zpool : string
        Name of storage pool

    device : string
        Existing device name too

    new_device : string
        New device name (to be attached to ``device``)

    force : boolean
        Forces use of device

    CLI Example:

    .. code-block:: bash

        salt '*' zpool.attach myzpool /path/to/vdev1 /path/to/vdev2 [...]

    rerr�attachrHFrr#Zattachedrrrsrrt�rrrr)r�device�
new_devicerfrr!rr=r
r
rryms*



��	�rycCs\tdtdd||gd�dd�}td|d�}|dr,ttd	|d
�|d|�|d<|S)
z�
    Detach specified device to zpool

    zpool : string
        Name of storage pool

    device : string
        Device to detach

    CLI Example:

    .. code-block:: bash

        salt '*' zpool.detach myzpool /path/to/vdev1

    rr�detachr`Frr#Z	detatchedrrrsrrt)rrr)rr{rr=r
r
rr}�s���r}cKs\i}|�di�}|�dd�r|�d�|d<tdtdd||||gd�dd	�}td
|d�S)a�
    .. versionadded:: 2018.3.0

    Splits devices off pool creating newpool.

    .. note::

        All vdevs in pool must be mirrors.  At the time of the split,
        ``newzpool`` will be a replica of ``zpool``.

        After splitting, do not forget to import the new pool!

    zpool : string
        Name of storage pool

    newzpool : string
        Name of new storage pool

    mountpoint : string
        Sets the mount point for the root dataset

    altroot : string
        Sets altroot for newzpool

    properties : dict
        Additional pool properties for newzpool

    CLI Examples:

    .. code-block:: bash

        salt '*' zpool.split datamirror databackup
        salt '*' zpool.split datamirror databackup altroot=/backup

    .. note::

        Zpool properties can be specified at the time of creation of the pool
        by passing an additional argument called "properties" and specifying
        the properties with their respective values in the form of a python
        dictionary:

        .. code-block:: text

            properties="{'property1': 'value1', 'property2': 'value2'}"

        Example:

        .. code-block:: bash

            salt '*' zpool.split datamirror databackup properties="{'readonly': 'on'}"

    CLI Example:

    .. code-block:: bash

        salt '*' zpool.split datamirror databackup
        salt '*' zpool.split datamirror databackup altroot=/backup

    rZrlFrmrrr7)rIrWrpr!rr#)rrr)rZnewzpoolrwrWrprr
r
rr7�s>��
r7cCs�g}g}|r|�d�|�|�|�|�|r|�|�tdtdd||d�dd�}td|d	�}|d	rGttd
|d�|d|�|d
<|S)a�
    Replaces ``old_device`` with ``new_device``

    .. note::

        This is equivalent to attaching ``new_device``,
        waiting for it to resilver, and then detaching ``old_device``.

        The size of ``new_device`` must be greater than or equal to the minimum
        size of all the devices in a mirror or raidz configuration.

    zpool : string
        Name of storage pool

    old_device : string
        Old device to replace

    new_device : string
        Optional new device

    force : boolean
        Forces use of new_device, even if its appears to be in use.

    CLI Example:

    .. code-block:: bash

        salt '*' zpool.replace myzpool /path/to/vdev1 /path/to/vdev2

    rerr�replacerHFrr#Zreplacedrrrsrrtrz)rZ
old_devicer|rfrr!rr=r
r
rr~s,!



��	�r~�mkfilecGs�t�}t�}tjj�d�}|D]F}tj�|�rd||<qtddj|||d�dd�}|dd	krQd
|vrPd|d
vrPd||<d�	|d
�
��d�d
d��||<qd||<q|r\||d<|S)a
    Creates file based virtual devices for a zpool

    CLI Example:

    .. code-block:: bash

        salt '*' zpool.create_file_vdev 7G /path/to/vdev1 [/path/to/vdev2] [...]

    .. note::

        Depending on file size, the above command may take a while to return.

    rZexistedrz{mkfile} {size} {vdev})r�sizerBFrr"r�stderrr%Zfailedr'Nrq�error)r�salt�utils�path�which�os�isfilerr9r8r6r7)r�rtr=�errZ_mkfile_cmdrBrr
r
r�create_file_vdevas.
��$�
r�cOsRg}g}|�dd�r|�d�t|�}tdtdd||d�dd�}td	|d
�S)ak
    .. versionadded:: 2015.5.0

    Export storage pools

    pools : string
        One or more storage pools to export

    force : boolean
        Force export of storage pools

    CLI Example:

    .. code-block:: bash

        salt '*' zpool.export myzpool ... [force=True|False]
        salt '*' zpool.export myzpool2 myzpool2 ... [force=True|False]

    rfFrerr�exportrHrr#Zexported)rrrrr)Zpoolsrwr�targetsrr
r
rr��s
��	r�c	Ksdg}i}g}|�di�}|�dd�s|�dd�r|�d�|�dd�r(|�d�|�dd�r3|�d�|�d	d�r@|�d	�|d
<|�dd�rM|�d�|d<|�d
d�r]|�d
��d�|d<|�dd�r�td�r�|�d�}|dvrv|�d�|dkr|�d�|dkr�|�d�|r�|�|�|�|�n|�d�tdtdd||||d�dd�}td|d�S) a?
    .. versionadded:: 2015.5.0

    Import storage pools or list pools available for import

    zpool : string
        Optional name of storage pool

    new_name : string
        Optional new name for the storage pool

    mntopts : string
        Comma-separated list of mount options to use when mounting datasets
        within the pool.

    force : boolean
        Forces import, even if the pool appears to be potentially active.

    altroot : string
        Equivalent to "-o cachefile=none,altroot=root"

    dir : string
        Searches for devices or files in dir, multiple dirs can be specified as
        follows: ``dir="dir1,dir2"``

    no_mount : boolean
        Import the pool without mounting any file systems.

    only_destroyed : boolean
        Imports destroyed pools only. This also sets ``force=True``.

    recovery : bool|str
        false: do not try to recovery broken pools
        true: try to recovery the pool by rolling back the latest transactions
        test: check if a pool can be recovered, but don't import it
        nolog: allow import without log device, recent transactions might be lost

        .. note::
            If feature flags are not support this forced to the default of 'false'

        .. warning::
            When recovery is set to 'test' the result will be have imported set to True if the pool
            can be imported. The pool might also be imported if the pool was not broken to begin with.

    properties : dict
        Additional pool properties

    .. note::

        Zpool properties can be specified at the time of creation of the pool
        by passing an additional argument called "properties" and specifying
        the properties with their respective values in the form of a python
        dictionary:

        .. code-block:: text

            properties="{'property1': 'value1', 'property2': 'value2'}"

    CLI Example:

    .. code-block:: bash

        salt '*' zpool.import [force=True|False]
        salt '*' zpool.import myzpool [mynewzpool] [force=True|False]
        salt '*' zpool.import myzpool dir='/tmp'

    rZrfFZonly_destroyedrez-DZno_mountz-NrlrmZmntoptsrU�dirrQz-d�recoveryrR)T�testz-Fr�z-nZnologrn�-arrr)rIrrWrpr!rr#Zimported)rrr7rr)	r�new_namerwrrWr!rpr�rr
r
rr�sNF








��rcOs�g}g}|�dd�r|�d�|�|�|r|�|�g}g}|�dd�r*|�d�|�|�|�|�tdtdd||d�dd�}td	|d
�S)a
    .. versionadded:: 2015.5.0

    Ensure that the specified devices are online

    zpool : string
        name of storage pool

    vdevs : string
        one or more devices

    expand : boolean
        Expand the device to use all available space.

        .. note::

            If the device is part of a mirror or raidz then all devices must be
            expanded before the new space will become available to the pool.

    CLI Example:

    .. code-block:: bash

        salt '*' zpool.online myzpool /path/to/vdev1 [...]

    �expandFz-err�onlinerHrr#Zonlined�rrrvrr�rrtrwrr!rr
r
rr�5s,





��	r�cOs^g}g}|�dd�r|�d�|�|�|�|�tdtdd||d�dd�}td	|d
�S)aG
    .. versionadded:: 2015.5.0

    Ensure that the specified devices are offline

    .. warning::

        By default, the ``OFFLINE`` state is persistent. The device remains
        offline when the system is rebooted. To temporarily take a device
        offline, use ``temporary=True``.

    zpool : string
        name of storage pool

    vdevs : string
        One or more devices

    temporary : boolean
        Enable temporarily offline

    CLI Example:

    .. code-block:: bash

        salt '*' zpool.offline myzpool /path/to/vdev1 [...] [temporary=True|False]

    Z	temporaryFz-trr�offlinerHrr#Zofflinedr�r�r
r
rr�vs


��	r�cCrc)ae
    .. versionadded:: 2018.3.0

    Removes ZFS label information from the specified device

    device : string
        Device name; must not be part of an active pool configuration.

    force : boolean
        Treat exported or foreign devices as inactive

    CLI Example:

    .. code-block:: bash

        salt '*' zpool.labelclear /path/to/dev

    rr�
labelclearreNrHFrr#Zlabelclearedr)r{rfrr
r
rr��s��	r�cCsBg}|�|�|�|�tdtdd|d�dd�}td|d�S)	a�
    Clears device errors in a pool.

    .. warning::

        The device must not be part of an active pool configuration.

    zpool : string
        name of storage pool
    device : string
        (optional) specific device to clear

    .. versionadded:: 2018.3.1

    CLI Example:

    .. code-block:: bash

        salt '*' zpool.clear mypool
        salt '*' zpool.clear mypool /path/to/dev

    rr�clearr`Frr#Zcleared�rrr)rr{r!rr
r
rr��s

��r�cC�*tdtdd|d�dd�}td|d�S)	ab
    Generates a new unique identifier for the pool

    .. warning::
        You must ensure that all devices in this pool are online and healthy
        before performing this action.

    zpool : string
        name of storage pool

    .. versionadded:: 2016.3.0

    CLI Example:

    .. code-block:: bash

        salt '*' zpool.reguid myzpool
    rr�reguidr`Frr#Zreguidedrrar
r
rr��s��r�cCr�)	z�
    Reopen all the vdevs associated with the pool

    zpool : string
        name of storage pool

    .. versionadded:: 2016.3.0

    CLI Example:

    .. code-block:: bash

        salt '*' zpool.reopen myzpool

    rr�reopenr`Frr#Zreopenedrrar
r
rr�s��r�cCsPg}i}|r
||d<|s|�d�tdtdd|||d�dd�}td	|d
�S)a~
    .. versionadded:: 2016.3.0

    Enables all supported features on the given pool

    zpool : string
        Optional storage pool, applies to all otherwize

    version : int
        Version to upgrade to, if unspecified upgrade to the highest possible

    .. warning::
        Once this is done, the pool will no longer be accessible on systems that do not
        support feature flags. See zpool-features(5) for details on compatibility with
        systems that support feature flags, but do not support all features enabled on the pool.

    CLI Example:

    .. code-block:: bash

        salt '*' zpool.upgrade myzpool

    z-Vr�rr�upgraderVFrr#Zupgradedr�)r�versionrrWrr
r
rr�2s 
��
r�c
Cs�t�}g}|r|�d�|r|�d�tdtdd||d�dd�}|d	d
kr.td|�Sd}|d
��D]*}|�d�rI|dd�}t�||<q6|dkrNq6|d
d�}|dd�}	|	|||<q6|S)a�
    .. versionadded:: 2016.3.0

    Displays the command history of the specified pools, or all pools if no
    pool is specified

    zpool : string
        Optional storage pool

    internal : boolean
        Toggle display of internally logged ZFS events

    verbose : boolean
        Toggle display of the user name, the hostname, and the zone in which
        the operation was performed

    CLI Example:

    .. code-block:: bash

        salt '*' zpool.upgrade myzpool

    z-lz-irr�historyrHFrr"rr#�unknownrzHistory for�
���r$��N)rrrrr5r<)
rZinternal�verboser=rrr(rDZ
log_timestampZlog_commandr
r
rr�cs6

��	
r�)N)NrET)rPNT)NFT)F)FF)NF)NN)NFF).�__doc__�loggingr�Zsalt.utils.decoratorsr�Zsalt.utils.decorators.pathZsalt.utils.pathZsalt.utils.odictr�	getLogger�__name__�logr	Z__func_alias__rrr rrFrrr_rbrdrgrorxryr}r7r~r�Z
decoratorsr�r�r�r�rr�r�r�r�r�r�r�r�r
r
r
r�<module>sV
�



t
eY&

:
59$
UB
+
-{A
6
 +
1