mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-16 22:50:10 +03:00
M #-: fix minor bug in OneFlow watch dog
This commit is contained in:
parent
897795fa6d
commit
15f211f4c6
@ -59,6 +59,8 @@ class ServiceLCM
|
||||
|
||||
@event_manager = EventManager.new(em_conf).am
|
||||
|
||||
@wd = ServiceWD.new(client, em_conf)
|
||||
|
||||
# Register Action Manager actions
|
||||
@am.register_action(ACTIONS['DEPLOY_CB'],
|
||||
method('deploy_cb'))
|
||||
@ -89,10 +91,7 @@ class ServiceLCM
|
||||
|
||||
Thread.new { catch_up(client) }
|
||||
|
||||
Thread.new do
|
||||
wd = ServiceWD.new(client, em_conf)
|
||||
wd.start(@srv_pool)
|
||||
end
|
||||
Thread.new { @wd.start(@srv_pool) }
|
||||
|
||||
Thread.new do
|
||||
auto_scaler = ServiceAutoScaler.new(@srv_pool,
|
||||
@ -243,6 +242,8 @@ class ServiceLCM
|
||||
if service.all_roles_running?
|
||||
service.set_state(Service::STATE['RUNNING'])
|
||||
service.update
|
||||
|
||||
@wd.add_service(service_id)
|
||||
end
|
||||
|
||||
# If there is no node in PENDING the service is not modified.
|
||||
@ -288,6 +289,8 @@ class ServiceLCM
|
||||
)
|
||||
end
|
||||
|
||||
@wd.remove_service(service_id)
|
||||
|
||||
set_deploy_strategy(service)
|
||||
|
||||
roles = service.roles_shutdown
|
||||
@ -341,6 +344,8 @@ class ServiceLCM
|
||||
)
|
||||
end
|
||||
|
||||
@wd.remove_service(service_id)
|
||||
|
||||
role = service.roles[role_name]
|
||||
|
||||
if role.nil?
|
||||
@ -477,6 +482,8 @@ 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)
|
||||
|
||||
@ -647,6 +654,8 @@ class ServiceLCM
|
||||
service.set_state(Service::STATE['RUNNING'])
|
||||
service.roles[role_name].set_state(Role::STATE['RUNNING'])
|
||||
|
||||
@wd.add_service(service_id)
|
||||
|
||||
service.update
|
||||
end
|
||||
|
||||
|
@ -53,6 +53,9 @@ class ServiceWD
|
||||
@cloud_auth = @conf[:cloud_auth]
|
||||
@wait_timeout = @cloud_auth.conf[:wait_timeout]
|
||||
@client = client
|
||||
|
||||
# Array of running services to watch
|
||||
@services = []
|
||||
end
|
||||
|
||||
# Start services WD
|
||||
@ -93,7 +96,10 @@ class ServiceWD
|
||||
|
||||
xml = Nokogiri::XML(Base64.decode64(content))
|
||||
|
||||
service_id = split_key[2]
|
||||
service_id = split_key[2].to_i
|
||||
|
||||
next unless @services.include?(service_id)
|
||||
|
||||
node = xml.xpath('/HOOK_MESSAGE/VM/ID').text.to_i
|
||||
state = xml.xpath('/HOOK_MESSAGE/STATE').text
|
||||
lcm_state = xml.xpath('/HOOK_MESSAGE/LCM_STATE').text
|
||||
@ -120,6 +126,20 @@ class ServiceWD
|
||||
unsubscribe(subscriber)
|
||||
end
|
||||
|
||||
# Add service to watch dog
|
||||
#
|
||||
# @param service_id [String] Service ID
|
||||
def add_service(service_id)
|
||||
@services << service_id.to_i
|
||||
end
|
||||
|
||||
# Remove service from watch dog
|
||||
#
|
||||
# @param service_id [String] Service ID
|
||||
def remove_service(service_id)
|
||||
@services.delete(service_id.to_i)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# Get OpenNebula client
|
||||
@ -164,6 +184,13 @@ class ServiceWD
|
||||
service_pool.each do |service|
|
||||
service.info
|
||||
|
||||
if service.state != Service::STATE['RUNNING'] &&
|
||||
service.state != Service::STATE['WARNING']
|
||||
next
|
||||
end
|
||||
|
||||
@services << service.id.to_i
|
||||
|
||||
service.roles.each do |name, role|
|
||||
role.nodes_ids.each do |node|
|
||||
check_role_state(client, service.id, name, node)
|
||||
|
@ -47,8 +47,6 @@ module DomainList
|
||||
vms
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
xml_txt = STDIN.read
|
||||
|
Loading…
x
Reference in New Issue
Block a user