use --wait with crm resource start/stop to avoid races

https://mailman.suse.de/mailman/private/ha-devel/2014-May/003603.html
(sorry - SUSE internal-only mailing list; but thread available on request)
This commit is contained in:
Adam Spiers 2014-05-14 14:05:35 -04:00
parent 68836e12bf
commit 9847e38ec0
2 changed files with 8 additions and 8 deletions

View File

@ -17,11 +17,11 @@ module Pacemaker
end
def crm_start_command
"crm --force resource start '#{name}'"
"crm --force --wait resource start '#{name}'"
end
def crm_stop_command
"crm --force resource stop '#{name}'"
"crm --force --wait resource stop '#{name}'"
end
# CIB object definitions look something like:

View File

@ -69,7 +69,7 @@ shared_examples "a runnable resource" do |fixture|
describe ":start action" do
it_should_behave_like "action on non-existent resource", \
:start,
"crm --force resource start #{fixture.name}", \
"crm --force --wait resource start #{fixture.name}", \
"Cannot start non-existent #{fixture}"
it "should do nothing to a started resource" do
@ -78,7 +78,7 @@ shared_examples "a runnable resource" do |fixture|
provider.run_action :start
cmd = "crm --force resource start #{fixture.name}"
cmd = "crm --force --wait resource start #{fixture.name}"
expect(@chef_run).not_to run_execute(cmd)
expect(@resource).not_to be_updated
end
@ -90,7 +90,7 @@ shared_examples "a runnable resource" do |fixture|
provider.run_action :start
cmd = "crm --force resource start '#{fixture.name}'"
cmd = "crm --force --wait resource start '#{fixture.name}'"
expect(@chef_run).to run_execute(cmd)
expect(@resource).to be_updated
end
@ -99,7 +99,7 @@ shared_examples "a runnable resource" do |fixture|
describe ":stop action" do
it_should_behave_like "action on non-existent resource", \
:stop,
"crm --force resource stop #{fixture.name}", \
"crm --force --wait resource stop #{fixture.name}", \
"Cannot stop non-existent #{fixture}"
it "should do nothing to a stopped resource" do
@ -108,7 +108,7 @@ shared_examples "a runnable resource" do |fixture|
provider.run_action :stop
cmd = "crm --force resource start #{fixture.name}"
cmd = "crm --force --wait resource start #{fixture.name}"
expect(@chef_run).not_to run_execute(cmd)
expect(@resource).not_to be_updated
end
@ -119,7 +119,7 @@ shared_examples "a runnable resource" do |fixture|
provider.run_action :stop
cmd = "crm --force resource stop '#{fixture.name}'"
cmd = "crm --force --wait resource stop '#{fixture.name}'"
expect(@chef_run).to run_execute(cmd)
expect(@resource).to be_updated
end