You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Change PCS modules/state module so, that it is possible to do
create a master slave resource
Setup
Requirements:
PCS is installed, pcs service is started.
there is a master / slave compatible resource. eg DRBD
pcs command:
pcs resource master --help
Usage: pcs resource master...
master [<master/slave id>] <resource id | group id> [options] [--wait[=n]]
Configure a resource or group as a multi-state (master/slave) resource.
If --wait is specified, pcs will wait up to 'n' seconds for the
operation to finish (including starting and promoting resource
instances if appropriate) and then return 0 on success or 1 on error.
If 'n' is not specified it defaults to 60 minutes.
Note: to remove a master you must remove the resource/group it contains.
adjust the Definition resource_present so that you can specify the create value in _item_present. "create = master"
or better write a separate Definition master_salve_present
Adaptation to the salt/states/pcs.py
def master_salve_present(name, resource_id, resource_type, resource_options=None, cibname=None):
'''
Ensure that a Master Slave 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 (other resouce_id)
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
drbd_pcs__master_slave_present_drbdname:
pcs.master_salve_present:
- resource_id: ms_drbdname
- resource_type: drbdname
- resource_options:
- master-max=1
- master-node-max=1
- clone-max=2
- clone-node-max=1
- notify=true
- target-role=Started
- cibname: cib_for_drbdname
'''
return _item_present(name=name,
item='resource',
create='master',
item_id=resource_id,
item_type=resource_type,
extra_args=resource_options,
cibname=cibname)
Add master slave resources to your cluster from the resource drbdname and override the default create with master
I ran into the same problem with PCS when I tried to do a more advanced configuration.
I put together a working solution, then thought to look and see if anybody else had raised this issue, which I thank you for filing.
As you pointed out, the 'resource_present' function can be easily repurposed to do this, with only a couple of minor changes. I named the new function 'master_present' in my solution for clarity. PCS uses the command 'master' to indicate the creation of a 'master/slave' resource, but this type of resource is also known as 'multi-state' or 'ms.'
The PCS resource command defines 4 types of resource that can be created:
'resource'
'group'
'master'
'clone'
So we should add corresponding 'group_present' and 'clone_present' functions as well as 'master_present'. I will take a look at that also.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.
Description of Issue/Question
Change PCS modules/state module so, that it is possible to do
Setup
Requirements:
PCS is installed, pcs service is started.
there is a master / slave compatible resource. eg DRBD
pcs command:
adjust the Definition resource_present so that you can specify the create value in _item_present. "create = master"
or better write a separate Definition master_salve_present
Adaptation to the salt/states/pcs.py
Add master slave resources to your cluster from the resource drbdname and override the default create with master
Or with seperate Definition master_salve_present
The text was updated successfully, but these errors were encountered: