mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-22 18:50:08 +03:00
(cherry picked from commit c0d32b71950918dd03499ba18b78fa3df18be83d)
This commit is contained in:
parent
eb1927750d
commit
96c40d94c9
@ -960,7 +960,11 @@ class ServiceLCM
|
||||
end
|
||||
|
||||
def running_wd_cb(client, service_id, role_name, _node)
|
||||
undeploy = false
|
||||
|
||||
rc = @srv_pool.get(service_id, client) do |service|
|
||||
role = service.roles[role_name]
|
||||
|
||||
if service.roles[role_name].state != Role::STATE['RUNNING']
|
||||
service.roles[role_name].set_state(Role::STATE['RUNNING'])
|
||||
end
|
||||
@ -970,10 +974,19 @@ class ServiceLCM
|
||||
service.set_state(Service::STATE['RUNNING'])
|
||||
end
|
||||
|
||||
# If the role has 0 nodes, delete role
|
||||
undeploy = service.check_role(role)
|
||||
|
||||
service.update
|
||||
end
|
||||
|
||||
Log.error 'WD', rc.message if OpenNebula.is_error?(rc)
|
||||
|
||||
return unless undeploy
|
||||
|
||||
Log.info LOG_COMP, "Automatically deleting service #{service_id}"
|
||||
|
||||
undeploy_action(client, service_id)
|
||||
end
|
||||
|
||||
############################################################################
|
||||
|
@ -214,6 +214,16 @@ class ServiceWD
|
||||
|
||||
next unless nodes_ids
|
||||
|
||||
if nodes_ids.empty?
|
||||
# If there are no VM, the role should be running
|
||||
@lcm.trigger_action(:running_wd_cb,
|
||||
service.id,
|
||||
client,
|
||||
service.id,
|
||||
name,
|
||||
[])
|
||||
end
|
||||
|
||||
nodes_ids.each do |node|
|
||||
check_role_state(client, service.id, name, node)
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user