mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-21 04:12:37 +09:00
appflow: Bug in shutdown procedure
For straight strategy, the parents of roles UNDEPLOYING were elegible for shutdown. Now the roles must be DONE. The none stragety did not shutdown roles DEPLOYING, leaving VMs running
This commit is contained in:
1 parent
b3f27191c3
commit
d1735f602a
2 files changed
+15
-15
No files matched your search
@@ -161,9 +161,9 @@ protected
|
||||
# @return [Hash<String, Role>] Roles
|
||||
def get_roles_shutdown(service)
|
||||
result = service.get_roles.select {|name, role|
|
||||
role.state == Role::STATE['RUNNING'] ||
|
||||
role.state == Role::STATE['FAILED'] ||
|
||||
role.state == Role::STATE['UNKNOWN']
|
||||
role.state != Role::STATE['UNDEPLOYING'] &&
|
||||
role.state != Role::STATE['FAILED'] &&
|
||||
role.state != Role::STATE['DONE']
|
||||
}
|
||||
|
||||
# Ruby 1.8 compatibility
|
||||
|
||||
@@ -100,23 +100,23 @@ module Straight
|
||||
|
||||
# Get all the parents from running roles
|
||||
parents = []
|
||||
running_roles = roles.select {|name, role|
|
||||
if (role.state == Role::STATE['RUNNING']||
|
||||
role.state == Role::STATE['FAILED'] ||
|
||||
role.state == Role::STATE['UNKNOWN'] )
|
||||
running_roles = {}
|
||||
|
||||
roles.each { |name, role|
|
||||
# All roles can be shutdown, except the ones in these states
|
||||
if (role.state != Role::STATE['UNDEPLOYING'] &&
|
||||
role.state != Role::STATE['FAILED'] &&
|
||||
role.state != Role::STATE['DONE'] )
|
||||
|
||||
running_roles[name]= role
|
||||
end
|
||||
|
||||
# Only the parents of DONE roles can be shutdown
|
||||
if (role.state != Role::STATE['DONE'] )
|
||||
parents += role.parents
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
}
|
||||
|
||||
# Ruby 1.8 compatibility
|
||||
if running_roles.instance_of?(Array)
|
||||
running_roles = Hash[running_roles]
|
||||
end
|
||||
|
||||
# Select the nodes that are not parent from any node
|
||||
result = running_roles.select {|name, role|
|
||||
!parents.include?(name)
|
||||
|
||||
Reference in new issue
Block a user