Feature #2120: Shutdown action can be set for each role, service, or in appflow-server.conf

This commit is contained in:
Carlos Martín committed 2013-06-19 16:47:52 +02:00
1 parent 56bd0157b0
commit da4df4fa4e
5 files changed
+38 -2

No files matched your search

+3
View File
@@ -33,6 +33,9 @@
# Default cooldown period after a scale operation, in seconds
:default_cooldown: 300
# Default shutdown action. Values: 'shutdown', 'shutdown-hard'
:shutdown_action: 'shutdown'
#############################################################
# Auth
#############################################################
+3 -1
View File
@@ -61,6 +61,7 @@ end
conf[:debug_level] ||= 2
conf[:lcm_interval] ||= 30
conf[:default_cooldown] ||= 300
conf[:shutdown_action] ||= 'shutdown'
conf[:auth] = 'opennebula'
@@ -112,10 +113,11 @@ before do
end
##############################################################################
# Cooldown config
# Defaults
##############################################################################
Role.init_default_cooldown(conf[:default_cooldown])
Role.init_default_shutdown(conf[:shutdown_action])
##############################################################################
# LCM thread
+20 -1
View File
@@ -294,6 +294,16 @@ module OpenNebula
n_nodes = nodes.size
end
action = @body['shutdown_action']
if action.nil?
action = @service.get_shutdown_action()
end
if action.nil?
action = @@default_shutdown
end
n_nodes.times { |i|
node = nodes[i]
@@ -302,7 +312,12 @@ module OpenNebula
Log.debug LOG_COMP, "Role #{name} : Shutting down VM #{vm_id}", @service.id()
vm = OpenNebula::VirtualMachine.new_with_id(vm_id, @service.client)
rc = vm.shutdown
if action == 'shutdown-hard'
rc = vm.shutdown(true)
else
rc = vm.shutdown
end
if scale_down
node['disposed'] = '1'
@@ -766,6 +781,10 @@ module OpenNebula
@@default_cooldown = default_cooldown
end
def self.init_default_shutdown(shutdown_action)
@@default_shutdown = shutdown_action
end
def update(template)
set_cardinality(template["cardinality"])
end
+4
View File
@@ -381,6 +381,10 @@ module OpenNebula
return OpenNebula::Error.new("ROLE \"#{role_name}\" does not exist")
end
def get_shutdown_action()
return @body['shutdown_action']
end
private
# @param [Logger::Severity] severity
+8
View File
@@ -38,6 +38,10 @@ module OpenNebula
:type => :string
}
},
'shutdown_action' => {
:type => :string,
:required => false
},
'min_vms' => {
:type => :integer,
:default => 1
@@ -136,6 +140,10 @@ module OpenNebula
:enum => %w{none straight},
:default => 'none'
},
'shutdown_action' => {
:type => :string,
:required => false
},
'roles' => {
:type => :array,
:items => ROLE_SCHEMA,