%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python2.7/site-packages/salt/states/
Upload File :
Create Path :
Current File : //lib/python2.7/site-packages/salt/states/pcs.pyo

�
���^c@@szdZddlmZmZmZddlZddlZddlZddl	Zddl
ZddlmZej
e�Zd�Zd�Zd�Zd�Zd	�Zd
�Zd�Zdd
ddd�Zdddd�Zddd�Zdd�Zddd�Zddd�Zddd�Zddd�Zddd�Z ddd�Z!ddd�Z"ddd�Z#dS(u�
Management of Pacemaker/Corosync clusters with PCS
==================================================

A state module to manage Pacemaker/Corosync clusters
with the Pacemaker/Corosync configuration system (PCS)

.. versionadded:: 2016.110

:depends: pcs

Walkthrough of a complete PCS cluster setup:
http://clusterlabs.org/doc/en-US/Pacemaker/1.1/html/Clusters_from_Scratch/

Requirements:
    PCS is installed, pcs service is started and
    the password for the hacluster user is set and known.

Remark on the cibname variable used in the examples:
    The use of the cibname variable is optional.
    Use it only if you want to deploy your changes into a cibfile first and then push it.
    This makes only sense if you want to deploy multiple changes (which require each other) at once to the cluster.

At first the cibfile must be created:

.. code-block:: yaml

    mysql_pcs__cib_present_cib_for_galera:
        pcs.cib_present:
            - cibname: cib_for_galera
            - scope: None
            - extra_args: None

Then the cibfile can be modified by creating resources (creating only 1 resource for demonstration, see also 7.):

.. code-block:: yaml

    mysql_pcs__resource_present_galera:
        pcs.resource_present:
            - resource_id: galera
            - resource_type: "ocf:heartbeat:galera"
            - resource_options:
                - 'wsrep_cluster_address=gcomm://node1.example.org,node2.example.org,node3.example.org'
                - '--master'
            - cibname: cib_for_galera

After modifying the cibfile, it can be pushed to the live CIB in the cluster:

.. code-block:: yaml

    mysql_pcs__cib_pushed_cib_for_galera:
        pcs.cib_pushed:
            - cibname: cib_for_galera
            - scope: None
            - extra_args: None

Create a cluster from scratch:

1. Authorize nodes to each other:

   .. code-block:: yaml

       pcs_auth__auth:
           pcs.auth:
               - nodes:
                   - node1.example.com
                   - node2.example.com
               - pcsuser: hacluster
               - pcspasswd: hoonetorg
               - extra_args: []

2. Do the initial cluster setup:

   .. code-block:: yaml

       pcs_setup__setup:
           pcs.cluster_setup:
               - nodes:
                   - node1.example.com
                   - node2.example.com
               - pcsclustername: pcscluster
               - extra_args:
                   - '--start'
                   - '--enable'

3. Optional: Set cluster properties:

   .. code-block:: yaml

       pcs_properties__prop_has_value_no-quorum-policy:
           pcs.prop_has_value:
               - prop: no-quorum-policy
               - value: ignore
               - cibname: cib_for_cluster_settings

4. Optional: Set resource defaults:

   .. code-block:: yaml

       pcs_properties__resource_defaults_to_resource-stickiness:
           pcs.resource_defaults_to:
               - default: resource-stickiness
               - value: 100
               - cibname: cib_for_cluster_settings

5. Optional: Set resource op defaults:

   .. code-block:: yaml

       pcs_properties__resource_op_defaults_to_monitor-interval:
           pcs.resource_op_defaults_to:
               - op_default: monitor-interval
               - value: 60s
               - cibname: cib_for_cluster_settings

6. Configure Fencing (!is often not optional on production ready cluster!):

   .. code-block:: yaml

       pcs_stonith__created_eps_fence:
           pcs.stonith_present:
               - stonith_id: eps_fence
               - stonith_device_type: fence_eps
               - stonith_device_options:
                   - 'pcmk_host_map=node1.example.org:01;node2.example.org:02'
                   - 'ipaddr=myepsdevice.example.org'
                   - 'power_wait=5'
                   - 'verbose=1'
                   - 'debug=/var/log/pcsd/eps_fence.log'
                   - 'login=hidden'
                   - 'passwd=hoonetorg'
               - cibname: cib_for_stonith

7. Add resources to your cluster:

   .. code-block:: yaml

       mysql_pcs__resource_present_galera:
           pcs.resource_present:
               - resource_id: galera
               - resource_type: "ocf:heartbeat:galera"
               - resource_options:
                   - 'wsrep_cluster_address=gcomm://node1.example.org,node2.example.org,node3.example.org'
                    - '--master'
                - cibname: cib_for_galera

8. Optional: Add constraints (locations, colocations, orders):

   .. code-block:: yaml

       haproxy_pcs__constraint_present_colocation-vip_galera-haproxy-clone-INFINITY:
           pcs.constraint_present:
               - constraint_id: colocation-vip_galera-haproxy-clone-INFINITY
               - constraint_type: colocation
               - constraint_options:
                   - 'add'
                   - 'vip_galera'
                   - 'with'
                   - 'haproxy-clone'
               - cibname: cib_for_haproxy

.. versionadded:: 2016.3.0
i(tabsolute_importtprint_functiontunicode_literalsN(tsixcC@stjjjd�rdStS(u/
    Only load if pcs package is installed
    upcs(tsalttutilstpathtwhichtFalse(((s3/usr/lib/python2.7/site-packages/salt/states/pcs.pyt__virtual__�scC@set}tjj|�ratjjj|d��"}tjjj	|j
��}WdQX|j�n|S(u(
    Read a file and return content
    ur+N(RtosRtexistsRRtfilestfopentstringutilst
to_unicodetreadtclose(Rtcontenttfp_((s3/usr/lib/python2.7/site-packages/salt/states/pcs.pyt
_file_read�s!
cC@sKtjjj|d��#}|jtjjj|��WdQX|j�dS(u!
    Write content to a file
    uw+N(RRRR
twriteRtto_strR(RRR((s3/usr/lib/python2.7/site-packages/salt/states/pcs.pyt_file_write�s"cC@s0tjjtddt�}tjd|�|S(uK
    Get the path to the directory on the minion where CIB's are saved
    ucachedirupcsucibpath: %s(R
Rtjoint__opts__t__env__tlogttrace(tcibpath((s3/usr/lib/python2.7/site-packages/salt/states/pcs.pyt_get_cibpath�scC@s8tjjt�dj|d��}tjd|�|S(uI
    Get the full path of a cached CIB-file with the name of the CIB
    u{0}.{1}ucibucibfile: %s(R
RRRtformatRR(tcibnametcibfile((s3/usr/lib/python2.7/site-packages/salt/states/pcs.pyt_get_cibfile�s$cC@s)djt|��}tjd|�|S(uL
    Get the full path of a temporary CIB-file with the name of the CIB
    u{0}.tmpucibfile_tmp: %s(RR"RR(R tcibfile_tmp((s3/usr/lib/python2.7/site-packages/salt/states/pcs.pyt_get_cibfile_tmp�scC@s)djt|��}tjd|�|S(ud
    Get the full path of the file containing a checksum of a CIB-file with the name of the CIB
    u	{0}.cksumucibfile_cksum: %s(RR"RR(R t
cibfile_cksum((s3/usr/lib/python2.7/site-packages/salt/states/pcs.pyt_get_cibfile_cksum�sushowucreatecC@s�i|d6td6dd6id6}t}	d#}
t|tj�rOt|�}
nt|ttf�smg}n|}d#}d|kr�|jd�dj	�}|j
|jd�ddd�j	�}tjd||�n|}
|d$ks�d|krd#}
nt
d
d|d|
d
|d|d|
�}tjd||
||
|�|d#k	r�x�|dj�D]�}t|jd��d%krh|jd�dj	�}|jd�dj	�}||gkr�||gkr�t}	q�q�qhqhWna|d&kr7xR|dj�D]$}dj|�|krt}	qqWn|dd'krPt}	n|	s�|dcdjtj|�tj|�tj|��7<|Stdr�d#|d<|dcdjtj|�tj|�tj|��7<|St
dd|d|d
|d|d|d|
�}tjd|�|dd(kr�|dcdj|||�7<|djiidd6tj|�d 6|6�n)t|d<|dcd!j|||�7<tjd"|�|S()u�
    Ensure that an item is created

    name
        Irrelevant, not used
    item
        config, property, resource, constraint etc.
    item_id
        id of the item
    item_type
        item type
    show
        show command (probably None, default: show)
    create
        create command (create or set f.e., default: create)
    extra_args
        additional options for the pcs command
    cibname
        use a cached CIB-file named like cibname instead of the live CIB
    unameuresultuucommentuchangesu=iuitem_id_key=%s item_id_value=%su
constraintu
pcs.item_showtitemtitem_idt	item_typetshowR!uFOutput of pcs.item_show item=%s item_id=%s item_type=%s cibfile=%s: %sustdoutu:iiu(id:{0})uretcodeu"{0} {1} ({2}) is already existing
utestu#{0} {1} ({2}) is set to be created
upcs.item_createtcreatet
extra_argsuOutput of pcs.item_create: %suCreated {0} {1} ({2})
uoldunewuFailed to create {0} {1} ({2})
uret: %sN(u
constraint(i(u
constraint(i(i(tTruetNonet
isinstanceRtstring_typesR"tlistttupletsplittstriptreplaceRRt__salt__t
splitlinestlenRRt	text_typeRtupdate(tnameR'R(R)R*R+R,R trettitem_create_requiredR!titem_id_keyt
item_id_valuetitem_id_showtis_existingtlinetkeytvaluetitem_create((s3/usr/lib/python2.7/site-packages/salt/states/pcs.pyt
_item_present�s|"	)			*

*
	2
u	haclusterc	C@s8i|d6td6dd6id6}t}tdd|�}tjd|�i}xm|d	j�D][}	|	jd
�dj�}
|	jd
�dj�}|
|krb|ji||
6�qbqbWtjd
|�xr|D]j}
|
|kr||
dkr|dcdj	|
�7<q�t}t
dr�|dcdj	|
�7<q�q�W|sP|St
drhd|d<|St|t
tf�s�g}nd|kr�|dg7}ntdd|d|d|d|�}tjd|�i}
xm|d	j�D][}	|	jd
�dj�}
|	jd
�dj�}|
|kr�|
ji||
6�q�q�Wtjd|
�x�|D]�}
|
|
kr�|
|
dkr�|dcdj	|
�7<|djiidd6dd6|
6�qdt|d<|
|kr|dcdj	|
||
�7<n|
|
krd|dcdj	|
|
|
�7<qdqdW|S( u�
    Ensure all nodes are authorized to the cluster

    name
        Irrelevant, not used (recommended: pcs_auth__auth)
    nodes
        a list of nodes which should be authorized to the cluster
    pcsuser
        user for communication with pcs (default: hacluster)
    pcspasswd
        password for pcsuser (default: hacluster)
    extra_args
        list of extra args for the 'pcs cluster auth' command

    Example:

    .. code-block:: yaml

        pcs_auth__auth:
            pcs.auth:
                - nodes:
                    - node1.example.com
                    - node2.example.com
                - pcsuser: hacluster
                - pcspasswd: hoonetorg
                - extra_args: []
    unameuresultuucommentuchangesupcs.is_authtnodesuOutput of pcs.is_auth: %sustdoutu:iiuauthorized_dict: %suAlready authorizeduNode {0} is already authorized
utestuNode is set to authorize: {0}
u--forceupcs.authtpcsusert	pcspasswdR,uOutput of pcs.auth: %suauthorize_dict: %su
AuthorizeduAuthorized {0}
uoldunewu/Authorization check for node {0} returned: {1}
u'Failed to authorize {0} with error {1}
N(R-RR6RRR7R3R4R:RRR.R/R1R2(R;RGRHRIR,R<t
auth_requiredt
authorizedtauthorized_dictRBtnodet
auth_statet	authorizetauthorize_dict((s3/usr/lib/python2.7/site-packages/salt/states/pcs.pytauthhsZ"

 

	%
)
#'u
pcsclusterc	C@sFi|d6td6dd6id6}t}td�}tjd|�x�|dj�D]�}t|jd	��d"krV|jd	�dj�}|jd	�dj�}	|d#kr|	|gkr�|dcdj	|�7<qt}t
dr|dcdj	|�7<qqqVqVW|s |St
dr8d$|d<|St|t
tf�sVg}ntdd|d|d|�}
tjd|
�i}x�|
dj�D]�}tjd|�tjdt|jd	���t|jd	��d%kr�|jd	�dj�}|jd	�dj�}
||krD|ji|
|6�qDq�q�Wtjd|�x�|D]�}||kr�||d&kr�|dcdj	|�7<|djiidd6dd6|6�q_t|d<|dcdj	|�7<||kr|dcd j	|||�7<n|dctj|
�7<q_Wtjd!|�|S('u�
    Setup Pacemaker cluster on nodes.
    Should be run on one cluster node only
    (there may be races)

    name
        Irrelevant, not used (recommended: pcs_setup__setup)
    nodes
        a list of nodes which should be set up
    pcsclustername
        Name of the Pacemaker cluster
    extra_args
        list of extra args for the 'pcs cluster setup' command

    Example:

    .. code-block:: yaml

        pcs_setup__setup:
            pcs.cluster_setup:
                - nodes:
                    - node1.example.com
                    - node2.example.com
                - pcsclustername: pcscluster
                - extra_args:
                    - '--start'
                    - '--enable'
    unameuresultuucommentuchangesupcs.config_showuOutput of pcs.config_show: %sustdoutu:iiiuCluster NameuCluster {0} is already set up
utestuCluster {0} is set to set up
upcs.cluster_setupRGtpcsclusternameR,uOutput of pcs.cluster_setup: %suline: %suline.split(:).len: %susetup_dict: %su	SucceededuSuccessuSet up {0}
uolduSetupunewuFailed to setup {0}
u{0}: setup_dict: {1}
uret: %s(i(uCluster NameN(i(u	SucceededuSuccess(R-RR6RRR7R8R3R4RRR.R/R1R2R:RR9(R;RGRRR,R<tsetup_requiredtconfig_showRBRCRDtsetupt
setup_dictRMtsetup_state((s3/usr/lib/python2.7/site-packages/salt/states/pcs.pyt
cluster_setup�sX"

&

	
)
#cC@si|d6td6dd6id6}t}g}dddd	g}td
|ddd
t�}tjd|�x�|dj�D]�}t|jd��d+kr}|jd�dj�}	|jd�dj�}
|	d,krAt|
j��dkr>||
j�kr(t}|dcdj	|�7<q;||
j�7}q>qAq}q}W|sO|St
dr�d-|d<|dcdj	|�7<|St|t
tf�s�g}ntdd|d|�}tjd|�i}x�|dj�D]�}tjd|�tjdt|jd���t|jd��d.kr�|jd�dj�}
|jd�dj�}|
||gkr�|ji||
6�q�q�q�Wtjd|�x�|D]�}
|
|kr||
d/kr6t|d<|dcd!j	|
�7<|dcd"j	|
||
�7<q6q�t|d<|dcd!j	|
�7<q�W||kr�||d0kr�|dcd%j	|�7<|djiidd&6d'd(6|6�nkt|d<|dcd)j	|�7<||kr�|dcd"j	|||�7<n|dctj|�7<tjd*|�|S(1u�
    Add a node to the Pacemaker cluster via PCS
    Should be run on one cluster node only
    (there may be races)
    Can only be run on a already setup/added node

    name
        Irrelevant, not used (recommended: pcs_setup__node_add_{{node}})
    node
        node that should be added
    extra_args
        list of extra args for the 'pcs cluster node add' command

    Example:

    .. code-block:: yaml

        pcs_setup__node_add_node1.example.com:
            pcs.cluster_node_present:
                - node: node1.example.com
                - extra_args:
                    - '--start'
                    - '--enable'
    unameuresultuucommentuchangesupcsustatusunodesucorosyncucmd.run_alltoutput_loglevelutracetpython_shellu'Output of pcs status nodes corosync: %sustdoutu:iiiuOfflineuOnlineu*Node {0} is already member of the cluster
utestu+Node {0} is set to be added to the cluster
upcs.cluster_node_addRMR,u"Output of pcs.cluster_node_add: %suline: %suline.split(:).len: %sunode_add_dict: %suCorosync updatedu+Failed to update corosync.conf on node {0}
u{0}: node_add_dict: {1}
u	SucceededuSuccessuAdded node {0}
uolduAddedunewuFailed to add node{0}
uret: %s(i(uOfflineuOnlineN(i(uCorosync updated(u	SucceededuSuccess(R-R6RRRR7R8R3R4RRR.R/R1R2R:RR9(R;RMR,R<tnode_add_requiredt
current_nodest
is_member_cmdt	is_memberRBRCRDtnode_addt
node_add_dicttcurrent_nodetcurrent_node_add_state((s3/usr/lib/python2.7/site-packages/salt/states/pcs.pytcluster_node_presentsl"

	

&
)
#c	C@s�i|d6td6dd6id6}d}t}t}t}t�}	t|�}
t|�}t|�}tjj|	�s�tj	|	�nt
|ttf�s�g}ntjj|�r�t
d|�nt
dd	|d
|d|�}
tjd|
�|
d
d%kstjj|�r:t|d<|dcd7<|Sdj|t
dd|d|��}tjd|�td|�}||gkr�t}ntjd|�tjj|
�s�t
dd|
d|�r�t}n|s�|r�t}n|s!t
d|�|dcdj|�7<n|sC|dcdj|�7<n|sM|Stdr�t
d|�d&|d<|r�|dcdj|�7<n|r�|dcdj|�7<n|S|rAt
d||
�t
dd|
d|�r|dcdj|�7<|dji|
d6�qAt|d<|dcd j|�7<n|r�t||�t|�|gkr�|dcd!j||�7<|dji|d"6�q�t|d<|dcd#j||�7<ntjd$|�|S('u�
    Ensure that a CIB-file with the content of the current live CIB is created

    Should be run on one cluster node only
    (there may be races)

    name
        Irrelevant, not used (recommended: {{formulaname}}__cib_present_{{cibname}})
    cibname
        name/path of the file containing the CIB
    scope
        specific section of the CIB (default:
    extra_args
        additional options for creating the CIB-file

    Example:

    .. code-block:: yaml

        mysql_pcs__cib_present_cib_for_galera:
            pcs.cib_present:
                - cibname: cib_for_galera
                - scope: None
                - extra_args: None
    unameuresultuucommentuchangesusha256ufile.removeupcs.cib_createR!tscopeR,uOutput of pcs.cib_create: %suretcodeiuFailed to get live CIB
u{0}:{1}u
file.get_hashRtformucib_hash_live: %sucib_hash_cur: %sufile.check_hasht	file_hashu)CIB {0} is already equal to the live CIB
uCIB {0} checksum is correct
utestu%CIB {0} is set to be created/updated
u.CIB {0} checksum is set to be created/updated
u	file.moveuCreated/updated CIB {0}
ucibfileu Failed to create/update CIB {0}
u(Created/updated checksum {0} of CIB {1}
ucibcksumu-Failed to create/update checksum {0} CIB {1}
uret: %s(iN(R-RRR"R$R&R
RRtmakedirsR/R1R2R6RRRRRR.R:R(R;R RdR,R<t
cib_hash_formtcib_create_requiredtcib_cksum_requiredtcib_requiredRR!R#R%t
cib_createt
cib_hash_livetcib_hash_cur((s3/usr/lib/python2.7/site-packages/salt/states/pcs.pytcib_presentxs|"		#
%	-		




cC@s�i|d6td6dd6id6}d}t}t|�}t|�}t|ttf�sdg}ntjj	|�s�t|d<|dcdj
|�7<|Sdj
|td	d
|d|��}	tj
d|	�t|�|	gkr�t}n|s|dcd
j
|�7<|StdrDd|d<|dcdj
|�7<|Stdd|d|d|�}
tj
d|
�|
ddkr�|dcdj
|�7<|dji|d6�n#t|d<|dcdj
|�7<tj
d|�|S(u�
    Ensure that a CIB-file is pushed if it is changed since the creation of it with pcs.cib_present

    Should be run on one cluster node only
    (there may be races)

    name
        Irrelevant, not used (recommended: {{formulaname}}__cib_pushed_{{cibname}})
    cibname
        name/path of the file containing the CIB
    scope
        specific section of the CIB
    extra_args
        additional options for creating the CIB-file

    Example:

    .. code-block:: yaml

        mysql_pcs__cib_pushed_cib_for_galera:
            pcs.cib_pushed:
                - cibname: cib_for_galera
                - scope: None
                - extra_args: None
    unameuresultuucommentuchangesusha256uCIB-file {0} does not exist
u{0}:{1}u
file.get_hashRReucib_hash_cibfile: %su>CIB {0} is not changed since creation through pcs.cib_present
utestu0CIB {0} is set to be pushed as the new live CIB
upcs.cib_pushR!RdR,uOutput of pcs.cib_push: %suretcodeiuPushed CIB {0}
ucibfile_pusheduFailed to push CIB {0}
uret: %sN(i(R-RR"R&R/R1R2R
RRRR6RRRRR.R:(R;R RdR,R<Rhtcib_push_requiredR!R%tcib_hash_cibfiletcib_push((s3/usr/lib/python2.7/site-packages/salt/states/pcs.pyt
cib_pushed�s>"	
%	


cC@s=td|ddddj||�ddddd	|d
|�S(u�
    Ensure that a property in the cluster is set to a given value

    Should be run on one cluster node only
    (there may be races)

    name
        Irrelevant, not used (recommended: pcs_properties__prop_has_value_{{prop}})
    prop
        name of the property
    value
        value of the property
    extra_args
        additional options for the pcs property command
    cibname
        use a cached CIB-file named like cibname instead of the live CIB

    Example:

    .. code-block:: yaml

        pcs_properties__prop_has_value_no-quorum-policy:
            pcs.prop_has_value:
                - prop: no-quorum-policy
                - value: ignore
                - cibname: cib_for_cluster_settings
    R;R'upropertyR(u{0}={1}R)R+usetR,R N(RFRR.(R;tpropRDR,R ((s3/usr/lib/python2.7/site-packages/salt/states/pcs.pytprop_has_value5scC@sCtd|ddddj||�ddddd	dd
|d|�S(
uP
    Ensure a resource default in the cluster is set to a given value

    Should be run on one cluster node only
    (there may be races)
    Can only be run on a node with a functional pacemaker/corosync

    name
        Irrelevant, not used (recommended: pcs_properties__resource_defaults_to_{{default}})
    default
        name of the default resource property
    value
        value of the default resource property
    extra_args
        additional options for the pcs command
    cibname
        use a cached CIB-file named like cibname instead of the live CIB

    Example:

    .. code-block:: yaml

        pcs_properties__resource_defaults_to_resource-stickiness:
            pcs.resource_defaults_to:
                - default: resource-stickiness
                - value: 100
                - cibname: cib_for_cluster_settings
    R;R'uresourceR(u{0}={1}R)R*udefaultsR+R,R N(RFRR.(R;tdefaultRDR,R ((s3/usr/lib/python2.7/site-packages/salt/states/pcs.pytresource_defaults_toZscC@sOtd|ddddj||�dd
ddd	gd
dd	gd|d|�S(uz
    Ensure a resource operation default in the cluster is set to a given value

    Should be run on one cluster node only
    (there may be races)
    Can only be run on a node with a functional pacemaker/corosync

    name
        Irrelevant, not used (recommended: pcs_properties__resource_op_defaults_to_{{op_default}})
    op_default
        name of the operation default resource property
    value
        value of the operation default resource property
    extra_args
        additional options for the pcs command
    cibname
        use a cached CIB-file named like cibname instead of the live CIB

    Example:

    .. code-block:: yaml

        pcs_properties__resource_op_defaults_to_monitor-interval:
            pcs.resource_op_defaults_to:
                - op_default: monitor-interval
                - value: 60s
                - cibname: cib_for_cluster_settings
    R;R'uresourceR(u{0}={1}R)R*uopudefaultsR+R,R N(RFRR.(R;t
op_defaultRDR,R ((s3/usr/lib/python2.7/site-packages/salt/states/pcs.pytresource_op_defaults_to�sc
C@s+td|ddd|d|d|d|�S(u�
    Ensure that a fencing resource is created

    Should be run on one cluster node only
    (there may be races)
    Can only be run on a node with a functional pacemaker/corosync

    name
        Irrelevant, not used (recommended: pcs_stonith__created_{{stonith_id}})
    stonith_id
        name for the stonith resource
    stonith_device_type
        name of the stonith agent fence_eps, fence_xvm f.e.
    stonith_device_options
        additional options for creating the stonith resource
    cibname
        use a cached CIB-file named like cibname instead of the live CIB

    Example:

    .. code-block:: yaml

        pcs_stonith__created_eps_fence:
            pcs.stonith_present:
                - stonith_id: eps_fence
                - stonith_device_type: fence_eps
                - stonith_device_options:
                    - 'pcmk_host_map=node1.example.org:01;node2.example.org:02'
                    - 'ipaddr=myepsdevice.example.org'
                    - 'power_wait=5'
                    - 'verbose=1'
                    - 'debug=/var/log/pcsd/eps_fence.log'
                    - 'login=hidden'
                    - 'passwd=hoonetorg'
                - cibname: cib_for_stonith
    R;R'ustonithR(R)R,R (RF(R;t
stonith_idtstonith_device_typetstonith_device_optionsR ((s3/usr/lib/python2.7/site-packages/salt/states/pcs.pytstonith_present�s%c
C@s+td|ddd|d|d|d|�S(u�
    Ensure that a resource is created

    Should be run on one cluster node only
    (there may be races)
    Can only be run on a node with a functional pacemaker/corosync

    name
        Irrelevant, not used (recommended: {{formulaname}}__resource_present_{{resource_id}})
    resource_id
        name for the resource
    resource_type
        resource type (f.e. ocf:heartbeat:IPaddr2 or VirtualIP)
    resource_options
        additional options for creating the resource
    cibname
        use a cached CIB-file named like cibname instead of the live CIB

    Example:

    .. code-block:: yaml

        mysql_pcs__resource_present_galera:
            pcs.resource_present:
                - resource_id: galera
                - resource_type: "ocf:heartbeat:galera"
                - resource_options:
                    - 'wsrep_cluster_address=gcomm://node1.example.org,node2.example.org,node3.example.org'
                    - '--master'
                - cibname: cib_for_galera
    R;R'uresourceR(R)R,R (RF(R;tresource_idt
resource_typetresource_optionsR ((s3/usr/lib/python2.7/site-packages/salt/states/pcs.pytresource_present�s cC@s1td|ddd|d|dd	d|d|�S(
ug
    Ensure that a constraint is created

    Should be run on one cluster node only
    (there may be races)
    Can only be run on a node with a functional pacemaker/corosync

    name
        Irrelevant, not used (recommended: {{formulaname}}__constraint_present_{{constraint_id}})
    constraint_id
        name for the constraint (try first to create manually to find out the autocreated name)
    constraint_type
        constraint type (location, colocation, order)
    constraint_options
        options for creating the constraint
    cibname
        use a cached CIB-file named like cibname instead of the live CIB

    Example:

    .. code-block:: yaml

        haproxy_pcs__constraint_present_colocation-vip_galera-haproxy-clone-INFINITY:
            pcs.constraint_present:
                - constraint_id: colocation-vip_galera-haproxy-clone-INFINITY
                - constraint_type: colocation
                - constraint_options:
                    - 'add'
                    - 'vip_galera'
                    - 'with'
                    - 'haproxy-clone'
                - cibname: cib_for_haproxy
    R;R'u
constraintR(R)R+R,R N(RFR.(R;t
constraint_idtconstraint_typetconstraint_optionsR ((s3/usr/lib/python2.7/site-packages/salt/states/pcs.pytconstraint_present�s"($t__doc__t
__future__RRRtloggingR
tsalt.utils.filesRtsalt.utils.pathtsalt.utils.stringutilstsalt.extRt	getLoggert__name__RR	RRRR"R$R&R.RFRQRXRcRoRsRuRwRyR}R�R�(((s3/usr/lib/python2.7/site-packages/salt/states/pcs.pyt<module>�s6													pWY`tI%''-(

Zerion Mini Shell 1.0