Fix non-working zero tolerance error group
Also: - catch divide by 0 in case of progress - catch sutuation with report for node without current tasks Change-Id: If4a975abf6da4ba1848be50a23f6532f649d2982 Closes-Bug: #1620858
This commit is contained in:
parent
67896b9a59
commit
9dee3b3da7
|
@ -114,7 +114,8 @@ module Astute
|
||||||
|
|
||||||
setup_fault_tolerance_behavior(
|
setup_fault_tolerance_behavior(
|
||||||
tasks_metadata['fault_tolerance_groups'],
|
tasks_metadata['fault_tolerance_groups'],
|
||||||
cluster
|
cluster,
|
||||||
|
tasks_graph.keys
|
||||||
)
|
)
|
||||||
critical_uids = critical_node_uids(cluster.fault_tolerance_groups)
|
critical_uids = critical_node_uids(cluster.fault_tolerance_groups)
|
||||||
|
|
||||||
|
@ -169,11 +170,11 @@ module Astute
|
||||||
tasks_graph
|
tasks_graph
|
||||||
end
|
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?
|
fault_tolerance_groups = [] if fault_tolerance_groups.nil?
|
||||||
|
|
||||||
defined_nodes = fault_tolerance_groups.map { |g| g['node_ids'] }.flatten.uniq
|
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
|
undefined_nodes = all_nodes - defined_nodes
|
||||||
|
|
||||||
fault_tolerance_groups << {
|
fault_tolerance_groups << {
|
||||||
|
|
|
@ -59,15 +59,17 @@ module Astute
|
||||||
'progress' => current_progress_bar,
|
'progress' => current_progress_bar,
|
||||||
}
|
}
|
||||||
node_status.merge!(node_report_status)
|
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!(
|
if task
|
||||||
'error_msg' => "Task #{task.name} failed on node #{name}"
|
node_status.merge!(
|
||||||
) if task.failed?
|
'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])
|
@ctx.report('nodes' => [node_status])
|
||||||
end
|
end
|
||||||
|
@ -96,7 +98,11 @@ module Astute
|
||||||
end
|
end
|
||||||
|
|
||||||
def current_progress_bar
|
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
|
end
|
||||||
|
|
||||||
def select_task_engine(data)
|
def select_task_engine(data)
|
||||||
|
|
|
@ -192,13 +192,6 @@ describe Astute::TaskDeployment do
|
||||||
|
|
||||||
it 'should support default zero tolerance policy for error on nodes' do
|
it 'should support default zero tolerance policy for error on nodes' do
|
||||||
cluster = mock('cluster')
|
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(
|
cluster.expects(:fault_tolerance_groups=).with(
|
||||||
[
|
[
|
||||||
{'fault_tolerance'=>0, 'name'=>'primary-controller', 'node_ids'=>['1']},
|
{'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'=>'ceph', 'node_ids'=>['1', '3']},
|
||||||
{'fault_tolerance'=>1, 'name'=>'ignored_group', 'node_ids'=>[]}
|
{'fault_tolerance'=>1, 'name'=>'ignored_group', 'node_ids'=>[]}
|
||||||
],
|
],
|
||||||
cluster
|
cluster,
|
||||||
|
['1', '2', '3', 'virtual_sync_node']
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue