B #5142: fix bug when terminating flow VM (#343)

(cherry picked from commit 5333ecf86c)
This commit is contained in:
Alejandro Huertas Herrero authored and Ruben S. Montero committed 2020-10-21 17:18:04 +02:00
1 parent 790f139f22
commit 613ea388ba
2 files changed
+8 -11

No files matched your search

+5 -2
View File
@@ -689,15 +689,18 @@ class ServiceLCM
role = service.roles[role_name]
cardinality = role.cardinality - 1
next unless role.nodes.find {|n| n['deploy_id'] == node }
# just update if the cardinality is positive
set_cardinality(role, cardinality, true) if cardinality >= 0
set_cardinality(role, cardinality, false) if cardinality >= 0
role.nodes.delete_if {|n| n['deploy_id'] == node }
service.update
Log.info 'WD',
"Update #{service_id}:#{role_name} " \
"Node #{node} is done, " \
"updating service #{service_id}:#{role_name} " \
"cardinality to #{cardinality}"
end
+3 -9
View File
@@ -233,22 +233,16 @@ class ServiceWD
if WARNING_STATES.include?(vm_lcm_state) ||
WARNING_STATES.include?(vm_state)
action = :error_wd_cb
action_msg = 'Warning'
action = :error_wd_cb
elsif vm_state == 'DONE'
action = :done_wd_cb
action_msg = 'Warning'
action = :done_wd_cb
elsif vm_lcm_state == 'RUNNING'
action = :running_wd_cb
action_msg = 'Running'
action = :running_wd_cb
else
# in case there is other state, ignore it
return
end
Log.info LOG_COMP,
"#{action_msg} #{service_id}: #{role_name} is #{vm_state}"
# execute callback
@lcm.trigger_action(action,
service_id,