Skip to content

Commit 17ee8a3

Browse files
committed
Merge branch 'stable/3.0' into staging-merge-3.0
2 parents 598e3e0 + c5ce757 commit 17ee8a3

File tree

6 files changed

+33
-34
lines changed

6 files changed

+33
-34
lines changed

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ source "https://rubygems.org"
2020
gem "sprockets-standalone", "~> 1.2.1"
2121

2222
group :development do
23+
gem "rake", "< 12.0.0"
2324
gem "closure-compiler", "~> 1.1.10"
2425
gem "sass", "~> 3.2.19"
2526
gem "sprockets", "~> 2.11.0"

chef/cookbooks/crowbar-pacemaker/recipes/drbd.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,7 @@
6767
lvm_group lvm_group
6868
end
6969

70-
include_recipe "drbd::default"
70+
# Disable drbd as it should never be started on boot (pacemaker should do it)
71+
service "drbd" do
72+
action :disable
73+
end

chef/cookbooks/drbd/providers/resource.rb

Lines changed: 24 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
raise "Remote node #{remote_host} not found!" if remote_nodes.empty?
3232
remote = remote_nodes.first
3333

34-
template "/etc/drbd.d/#{name}.res" do
34+
drbd_resource_template = template "/etc/drbd.d/#{name}.res" do
3535
cookbook "drbd"
3636
source "resource.erb"
3737
variables(
@@ -47,45 +47,35 @@
4747
owner "root"
4848
group "root"
4949
action :nothing
50-
end.run_action(:create)
50+
end
51+
drbd_resource_template.run_action(:create)
5152

5253
# first pass only, initialize drbd
5354
# for disks re-usage from old resources we will run with force option
54-
p = execute "drbdadm -- --force create-md #{name}" do
55-
only_if do
56-
overview = DrbdOverview.get(name)
57-
!overview.nil? && overview["state"] == "Unconfigured"
58-
end
55+
drbdadm_create_md = execute "drbdadm -- --force create-md #{name}" do
56+
only_if { drbd_resource_template.updated_by_last_action? }
5957
action :nothing
6058
end
61-
p.run_action(:run)
59+
drbdadm_create_md.run_action(:run)
6260

63-
if p.updated_by_last_action?
64-
# we would usually do something like:
65-
# notifies :restart, "service[drbd]", :immediately
66-
# in the execute above; but the notification doesn't work (probably because
67-
# we're already in a LWRP). So we hack around this.
68-
service "drbd(#{name})" do
69-
service_name "drbd"
70-
action :nothing
71-
end.run_action(:restart)
61+
drbdadm_up = execute "drbdadm up #{name}" do
62+
only_if { drbd_resource_template.updated_by_last_action? }
63+
action :nothing
7264
end
65+
drbdadm_up.run_action(:run)
7366

74-
overview = DrbdOverview.get(name)
75-
if !overview.nil? && overview["state"] != "Unconfigured" && overview["primary"].nil?
76-
# claim primary based off of master
77-
execute "drbdadm -- --overwrite-data-of-peer primary #{name}" do
78-
only_if { master }
79-
action :nothing
80-
end.run_action(:run)
67+
# claim primary based off of master
68+
execute "drbdadm -- --overwrite-data-of-peer primary #{name}" do
69+
only_if { drbd_resource_template.updated_by_last_action? && master }
70+
action :nothing
71+
end.run_action(:run)
8172

82-
# you may now create a filesystem on the device, use it as a raw block device
83-
# for disks re-usage from old resources we will run with force option
84-
execute "mkfs -t #{fstype} -f #{device}" do
85-
only_if { master }
86-
action :nothing
87-
end.run_action(:run)
88-
end
73+
# you may now create a filesystem on the device, use it as a raw block device
74+
# for disks re-usage from old resources we will run with force option
75+
execute "mkfs -t #{fstype} -f #{device}" do
76+
only_if { drbd_resource_template.updated_by_last_action? && master }
77+
action :nothing
78+
end.run_action(:run)
8979

9080
unless mount.nil? or mount.empty?
9181
directory mount do
@@ -100,7 +90,10 @@
10090
action :nothing
10191
end.run_action(:mount)
10292
end
93+
end
10394

95+
action :wait do
96+
name = new_resource.name
10497
begin
10598
Timeout.timeout(20) do
10699
while true

chef/cookbooks/drbd/resources/resource.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# limitations under the License.
1515
#
1616

17-
actions :create
17+
actions :create, :wait
1818
default_action :create
1919

2020
attribute :name, kind_of: String, name_attribute: true

chef/cookbooks/pacemaker/Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
source "https://rubygems.org"
22

33
#gem 'berkshelf', '~> 2.0'
4+
gem "rack", "< 2.0.0"
45
gem "rake"
56

67
group :test, :development do

crowbar_framework/app/models/pacemaker_service.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,8 @@ def apply_cluster_roles_to_new_nodes_for(cluster_element, relevant_nodes, all_ro
154154
end
155155

156156
expanded_nodes.sort!
157-
old_expanded_nodes = deployment["elements_expanded"][role_name].sort
157+
old_expanded_nodes = deployment["elements_expanded"][role_name] || []
158+
old_expanded_nodes.sort!
158159

159160
if old_expanded_nodes != expanded_nodes
160161
deployment["elements_expanded"][role_name] = expanded_nodes

0 commit comments

Comments
 (0)