Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
def upgrade(template_attrs, template_deployment, attrs, deployment)
deployment["config"]["transition_list"] = template_deployment["config"]["transition_list"]
deployment["config"]["transitions"] = template_deployment["config"]["transitions"]
return attrs, deployment
end

def downgrade(template_attrs, template_deployment, attrs, deployment)
deployment["config"]["transition_list"] = template_deployment["config"]["transition_list"]
deployment["config"]["transitions"] = template_deployment["config"]["transitions"]
return attrs, deployment
end
7 changes: 3 additions & 4 deletions chef/data_bags/crowbar/template-pacemaker.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"pacemaker": {
"crowbar-revision": 0,
"crowbar-applied": false,
"schema-revision": 301,
"schema-revision": 302,
"element_states": {
"pacemaker-cluster-member" : [ "readying", "ready", "applying" ],
"hawk-server" : [ "readying", "ready", "applying" ],
Expand All @@ -80,9 +80,8 @@
"config": {
"environment": "pacemaker-base-config",
"mode": "full",
"transitions": false,
"transition_list": [
]
"transitions": true,
"transition_list": [ "delete" ]
}
}
}
Expand Down
28 changes: 28 additions & 0 deletions crowbar_framework/app/models/pacemaker_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -955,6 +955,34 @@ def prepare_stonith_attributes(role_attributes, remote_nodes, member_nodes, remo
end
end

def transition(inst, name, state)
Comment thread
sandonovsuse marked this conversation as resolved.
Comment thread
sandonovsuse marked this conversation as resolved.
@logger.debug("Pacemaker transition: entering: #{name} for #{state}")

if state == "delete"
proposal = Proposal.find_by(barclamp: @bc_name, name: inst)
stonith_mode = proposal["attributes"]["pacemaker"]["stonith"]["mode"]

# remove node from stonith cfg
proposal["attributes"]["pacemaker"]["stonith"][
stonith_mode]["nodes"].delete(name)
if proposal["attributes"]["pacemaker"]["stonith"]["per_node"]["nodes"]
proposal["attributes"]["pacemaker"]["stonith"][
"per_node"]["nodes"].delete(name)
end

# remove from pacemaker-cluster-member
proposal["deployment"]["pacemaker"]["elements"][
"pacemaker-cluster-member"].delete(name)

# Save and commit
proposal.save
proposal_commit(inst, in_queue: false, validate: false, validate_after_save: false)
end

@logger.debug("Pacemaker transition: exiting: #{name} for #{state}")
[200, { name: name }]
end

private

def pacemaker_node_name(node, remotes)
Expand Down