M #-: fix bug in OneFlow service watchdog (#352)

(cherry picked from commit 5e07e0921b)
This commit is contained in:
Alejandro Huertas Herrero authored and Ruben S. Montero committed 2020-10-23 10:27:19 +02:00
1 parent 0a0a24aa80
commit 495ee3d2fb
2 files changed
+18 -10

No files matched your search

+8 -6
View File
@@ -241,7 +241,7 @@ class ServiceLCM
service.set_state(Service::STATE['RUNNING'])
service.update
@wd.add_service(service_id)
@wd.add_service(service)
end
# If there is no node in PENDING the service is not modified.
@@ -484,8 +484,6 @@ class ServiceLCM
if service.all_roles_running?
service.set_state(Service::STATE['RUNNING'])
@wd.add_service(service_id)
elsif service.strategy == 'straight'
set_deploy_strategy(service)
@@ -497,7 +495,11 @@ class ServiceLCM
service.report_ready?)
end
service.update
rc = service.update
return rc if OpenNebula.is_error?(rc)
@wd.add_service(service) if service.all_roles_running?
end
Log.error LOG_COMP, rc.message if OpenNebula.is_error?(rc)
@@ -656,9 +658,9 @@ class ServiceLCM
service.set_state(Service::STATE['RUNNING'])
service.roles[role_name].set_state(Role::STATE['RUNNING'])
@wd.add_service(service_id)
service.update
@wd.add_service(service)
end
Log.error LOG_COMP, rc.message if OpenNebula.is_error?(rc)
+10 -4
View File
@@ -133,10 +133,16 @@ class ServiceWD
# Add service to watch dog
#
# @param service_id [String] Service ID
def add_service(service_id)
# @param service [Service] Service information
def add_service(service)
@mutex.synchronize do
@services << service_id.to_i
@services << Integer(service.id)
end
service.roles.each do |name, role|
role.nodes_ids.each do |node|
check_role_state(client, service.id, name, node)
end
end
end
@@ -196,7 +202,7 @@ class ServiceWD
end
@mutex.synchronize do
@services << service.id.to_i
@services << Integer(service.id)
end
service.roles.each do |name, role|