-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #164 from vuntz/no-require-pacemaker-chef-run
Do not require crowbar-pacemaker cookbook to run when we configure HA in openstack
- Loading branch information
Showing
8 changed files
with
171 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# | ||
# Author:: Vincent Untz | ||
# Cookbook Name:: crowbar-pacemaker | ||
# Recipe:: attributes | ||
# | ||
# Copyright 2016, SUSE | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
node[:pacemaker][:attributes].each do |attr, value| | ||
execute %(set pacemaker attribute "#{attr}" to "#{value}") do | ||
command %(crm node attribute #{node[:hostname]} set "#{attr}" "#{value}") | ||
# The cluster only does a transition if the attribute value changes, | ||
# so checking the value before setting would only slow things down | ||
# for no benefit. | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# | ||
# Cookbook Name:: crowbar-pacemaker | ||
# Recipe:: drbd | ||
# | ||
# Copyright 2014, SUSE | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
claim_string = "LVM_DRBD" | ||
lvm_group = "drbd" | ||
lvm_disk = nil | ||
|
||
unclaimed_disks = BarclampLibrary::Barclamp::Inventory::Disk.unclaimed(node).sort | ||
claimed_disks = BarclampLibrary::Barclamp::Inventory::Disk.claimed(node, claim_string).sort | ||
|
||
if claimed_disks.empty? && !unclaimed_disks.empty? | ||
unclaimed_disks.each do |disk| | ||
if disk.claim(claim_string) | ||
Chef::Log.info("#{claim_string}: Claimed #{disk.name}") | ||
lvm_disk = disk | ||
break | ||
else | ||
Chef::Log.info("#{claim_string}: Ignoring #{disk.name}") | ||
end | ||
end | ||
else | ||
lvm_disk = claimed_disks.first | ||
end | ||
|
||
if lvm_disk.nil? | ||
message = "There is no suitable disk for LVM for DRBD!" | ||
Chef::Log.fatal(message) | ||
raise message | ||
end | ||
|
||
# SLE11 only | ||
if node[:platform] == "suse" && node[:platform_version].to_f < 12.0 | ||
# Make sure that LVM is setup on boot | ||
service "boot.lvm" do | ||
action [:enable] | ||
end | ||
end | ||
|
||
include_recipe "lvm::default" | ||
|
||
lvm_physical_volume lvm_disk.name | ||
|
||
lvm_volume_group lvm_group do | ||
physical_volumes [lvm_disk.name] | ||
end | ||
|
||
include_recipe "drbd::install" | ||
include_recipe "drbd::config" | ||
|
||
# Disable drbd as it should never be started on boot (pacemaker should do it) | ||
# However, start it because on initial setup, we currently require drbd to be | ||
# running. | ||
service "drbd" do | ||
action [:disable, :start] | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# | ||
# Author:: Vincent Untz | ||
# Cookbook Name:: crowbar-pacemaker | ||
# Recipe:: openstack | ||
# | ||
# Copyright 2016, SUSE | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
# if we ever want to not have a hard dependency on openstack here, we can have | ||
# Crowbar set a node[:pacemaker][:resource_agents] attribute based on available | ||
# barclamps, and do: | ||
# node[:pacemaker][:resource_agents].each do |resource_agent| | ||
# node[:pacemaker][:platform][:resource_packages][resource_agent].each do |pkg| | ||
# package pkg | ||
# end | ||
# end | ||
node[:pacemaker][:platform][:resource_packages][:openstack].each do |pkg| | ||
package pkg | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
chef/cookbooks/crowbar-pacemaker/recipes/remote_attributes.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# | ||
# Author:: Vincent Untz | ||
# Cookbook Name:: crowbar-pacemaker | ||
# Recipe:: attributes | ||
# | ||
# Copyright 2016, SUSE | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
CrowbarPacemakerHelper.remote_nodes(node).each do |remote| | ||
remote[:pacemaker][:attributes].each do |attr, value| | ||
execute %(set pacemaker attribute "#{attr}" to "#{value}" on remote #{remote[:hostname]}) do | ||
command %(crm node attribute remote-#{remote[:hostname]} set "#{attr}" "#{value}") | ||
# The cluster only does a transition if the attribute value changes, | ||
# so checking the value before setting would only slow things down | ||
# for no benefit. | ||
only_if { CrowbarPacemakerHelper.is_cluster_founder?(node) } | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters