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:
@@ -17,11 +17,11 @@ module Pacemaker
|
|||||||
end
|
end
|
||||||
|
|
||||||
def crm_start_command
|
def crm_start_command
|
||||||
"crm --force resource start '#{name}'"
|
"crm --force --wait resource start '#{name}'"
|
||||||
end
|
end
|
||||||
|
|
||||||
def crm_stop_command
|
def crm_stop_command
|
||||||
"crm --force resource stop '#{name}'"
|
"crm --force --wait resource stop '#{name}'"
|
||||||
end
|
end
|
||||||
|
|
||||||
# CIB object definitions look something like:
|
# CIB object definitions look something like:
|
||||||
|
@@ -69,7 +69,7 @@ shared_examples "a runnable resource" do |fixture|
|
|||||||
describe ":start action" do
|
describe ":start action" do
|
||||||
it_should_behave_like "action on non-existent resource", \
|
it_should_behave_like "action on non-existent resource", \
|
||||||
:start,
|
:start,
|
||||||
"crm --force resource start #{fixture.name}", \
|
"crm --force --wait resource start #{fixture.name}", \
|
||||||
"Cannot start non-existent #{fixture}"
|
"Cannot start non-existent #{fixture}"
|
||||||
|
|
||||||
it "should do nothing to a started resource" do
|
it "should do nothing to a started resource" do
|
||||||
@@ -78,7 +78,7 @@ shared_examples "a runnable resource" do |fixture|
|
|||||||
|
|
||||||
provider.run_action :start
|
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(@chef_run).not_to run_execute(cmd)
|
||||||
expect(@resource).not_to be_updated
|
expect(@resource).not_to be_updated
|
||||||
end
|
end
|
||||||
@@ -90,7 +90,7 @@ shared_examples "a runnable resource" do |fixture|
|
|||||||
|
|
||||||
provider.run_action :start
|
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(@chef_run).to run_execute(cmd)
|
||||||
expect(@resource).to be_updated
|
expect(@resource).to be_updated
|
||||||
end
|
end
|
||||||
@@ -99,7 +99,7 @@ shared_examples "a runnable resource" do |fixture|
|
|||||||
describe ":stop action" do
|
describe ":stop action" do
|
||||||
it_should_behave_like "action on non-existent resource", \
|
it_should_behave_like "action on non-existent resource", \
|
||||||
:stop,
|
:stop,
|
||||||
"crm --force resource stop #{fixture.name}", \
|
"crm --force --wait resource stop #{fixture.name}", \
|
||||||
"Cannot stop non-existent #{fixture}"
|
"Cannot stop non-existent #{fixture}"
|
||||||
|
|
||||||
it "should do nothing to a stopped resource" do
|
it "should do nothing to a stopped resource" do
|
||||||
@@ -108,7 +108,7 @@ shared_examples "a runnable resource" do |fixture|
|
|||||||
|
|
||||||
provider.run_action :stop
|
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(@chef_run).not_to run_execute(cmd)
|
||||||
expect(@resource).not_to be_updated
|
expect(@resource).not_to be_updated
|
||||||
end
|
end
|
||||||
@@ -119,7 +119,7 @@ shared_examples "a runnable resource" do |fixture|
|
|||||||
|
|
||||||
provider.run_action :stop
|
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(@chef_run).to run_execute(cmd)
|
||||||
expect(@resource).to be_updated
|
expect(@resource).to be_updated
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user