Merge "Fix non-working zero tolerance error group"

This commit is contained in:
Jenkins 2016-09-26 10:56:49 +00:00 committed by Gerrit Code Review
commit c11a24c052
3 changed files with 21 additions and 20 deletions

View File

@ -114,7 +114,8 @@ module Astute
setup_fault_tolerance_behavior(
tasks_metadata['fault_tolerance_groups'],
cluster
cluster,
tasks_graph.keys
)
critical_uids = critical_node_uids(cluster.fault_tolerance_groups)
@ -169,11 +170,11 @@ module Astute
tasks_graph
end
def setup_fault_tolerance_behavior(fault_tolerance_groups, cluster)
def setup_fault_tolerance_behavior(fault_tolerance_groups, cluster, nodes)
fault_tolerance_groups = [] if fault_tolerance_groups.nil?
defined_nodes = fault_tolerance_groups.map { |g| g['node_ids'] }.flatten.uniq
all_nodes = cluster.nodes.map{ |n| n[0].to_s }.select{ |n| !sync_point?(n) }
all_nodes = nodes.select{ |n| !sync_point?(n) }
undefined_nodes = all_nodes - defined_nodes
fault_tolerance_groups << {

View File

@ -60,15 +60,17 @@ module Astute
'progress' => current_progress_bar,
}
node_status.merge!(node_report_status)
node_status.merge!(
'deployment_graph_task_name' => task.name,
'task_status' => task.status.to_s,
'summary' => @task_engine.summary
) if task
node_status.merge!(
'error_msg' => "Task #{task.name} failed on node #{name}"
) if task.failed?
if task
node_status.merge!(
'deployment_graph_task_name' => task.name,
'task_status' => task.status.to_s,
'summary' => @task_engine.summary
)
node_status.merge!(
'error_msg' => "Task #{task.name} failed on node #{name}"
) if task.failed?
end
@ctx.report('nodes' => [node_status])
end
@ -97,7 +99,11 @@ module Astute
end
def current_progress_bar
100 * tasks_finished_count / tasks_total_count
if tasks_total_count != 0
100 * tasks_finished_count / tasks_total_count
else
100
end
end
def select_task_engine(data)

View File

@ -192,13 +192,6 @@ describe Astute::TaskDeployment do
it 'should support default zero tolerance policy for error on nodes' do
cluster = mock('cluster')
cluster.stubs(:nodes).returns([
['1', mock('node_1')],
['2', mock('node_2')],
['3', mock('node_3')],
['virtual_sync_node', mock('null')]
])
cluster.expects(:fault_tolerance_groups=).with(
[
{'fault_tolerance'=>0, 'name'=>'primary-controller', 'node_ids'=>['1']},
@ -215,7 +208,8 @@ describe Astute::TaskDeployment do
{'fault_tolerance'=>1, 'name'=>'ceph', 'node_ids'=>['1', '3']},
{'fault_tolerance'=>1, 'name'=>'ignored_group', 'node_ids'=>[]}
],
cluster
cluster,
['1', '2', '3', 'virtual_sync_node']
)
end