1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-22 18:50:08 +03:00

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

(cherry picked from commit 5333ecf86cd7ce51fe92dadf93def6dc6feb59ff)
This commit is contained in:
Alejandro Huertas Herrero 2020-10-21 17:16:40 +02:00 committed by Ruben S. Montero
parent 790f139f22
commit 613ea388ba
No known key found for this signature in database
GPG Key ID: A0CEA6FA880A1D87
2 changed files with 8 additions and 11 deletions

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

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,