mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-21 04:12:37 +09:00
Feature #1852: Elasticity works also in the UNKNOWN Service state
This commit is contained in:
1 parent
793329b9ef
commit
c0aa6e6558
3 files changed
+35
-15
No files matched your search
@@ -69,19 +69,25 @@ class ServiceLCM
|
||||
service.set_state(Service::STATE['FAILED_DEPLOYING'])
|
||||
end
|
||||
end
|
||||
when Service::STATE['RUNNING']
|
||||
when Service::STATE['RUNNING'], Service::STATE['UNKNOWN']
|
||||
strategy.monitor_step(service)
|
||||
|
||||
if !service.all_roles_running?
|
||||
service.set_state(Service::STATE['UNKNOWN'])
|
||||
if service.all_roles_running?
|
||||
if service.state() == Service::STATE['UNKNOWN']
|
||||
service.set_state(Service::STATE['RUNNING'])
|
||||
end
|
||||
else
|
||||
if strategy.apply_scaling_policies(service)
|
||||
service.set_state(Service::STATE['SCALING'])
|
||||
if service.state() == Service::STATE['RUNNING']
|
||||
service.set_state(Service::STATE['UNKNOWN'])
|
||||
end
|
||||
end
|
||||
|
||||
rc = strategy.scale_step(service)
|
||||
if !rc[0]
|
||||
service.set_state(Service::STATE['FAILED_SCALING'])
|
||||
end
|
||||
if strategy.apply_scaling_policies(service)
|
||||
service.set_state(Service::STATE['SCALING'])
|
||||
|
||||
rc = strategy.scale_step(service)
|
||||
if !rc[0]
|
||||
service.set_state(Service::STATE['FAILED_SCALING'])
|
||||
end
|
||||
end
|
||||
when Service::STATE['SCALING']
|
||||
@@ -106,12 +112,6 @@ class ServiceLCM
|
||||
if !service.any_role_failed_scaling?
|
||||
service.set_state(Service::STATE['SCALING'])
|
||||
end
|
||||
when Service::STATE['UNKNOWN']
|
||||
strategy.monitor_step(service)
|
||||
|
||||
if service.all_roles_running?
|
||||
service.set_state(Service::STATE['RUNNING'])
|
||||
end
|
||||
when Service::STATE['FAILED']
|
||||
strategy.monitor_step(service)
|
||||
|
||||
|
||||
@@ -864,6 +864,16 @@ module ElasticityGrammar
|
||||
|
||||
nodes.each { |node|
|
||||
if node && node['vm_info']
|
||||
|
||||
vm_state = node['vm_info']['VM']['STATE']
|
||||
lcm_state = node['vm_info']['VM']['LCM_STATE']
|
||||
|
||||
# Use values from VMs in RUNNING only
|
||||
|
||||
if vm_state != '3' || lcm_state != '3'
|
||||
next
|
||||
end
|
||||
|
||||
if node['vm_info']['VM']['USER_TEMPLATE'][att]
|
||||
total += (node['vm_info']['VM']['USER_TEMPLATE'][att]).to_f
|
||||
n_nodes += 1
|
||||
|
||||
@@ -160,6 +160,16 @@ grammar ElasticityGrammar
|
||||
|
||||
nodes.each { |node|
|
||||
if node && node['vm_info']
|
||||
|
||||
vm_state = node['vm_info']['VM']['STATE']
|
||||
lcm_state = node['vm_info']['VM']['LCM_STATE']
|
||||
|
||||
# Use values from VMs in RUNNING only
|
||||
|
||||
if vm_state != '3' || lcm_state != '3'
|
||||
next
|
||||
end
|
||||
|
||||
if node['vm_info']['VM']['USER_TEMPLATE'][att]
|
||||
total += (node['vm_info']['VM']['USER_TEMPLATE'][att]).to_f
|
||||
n_nodes += 1
|
||||
|
||||
Reference in new issue
Block a user