Feature #2118: Default cooldown can be set in appflow-server.conf

This commit is contained in:
Carlos Martín committed 2013-06-13 12:22:55 +02:00
1 parent bf0245d17c
commit 18ddad5cc8
3 files changed
+17 -2

No files matched your search

+3
View File
@@ -30,6 +30,9 @@
:host: 127.0.0.1
:port: 2474
# Default cooldown period after a scale operation, in seconds
:default_cooldown: 300
#############################################################
# Auth
#############################################################
+5
View File
@@ -60,6 +60,7 @@ end
conf[:debug_level] ||= 2
conf[:lcm_interval] ||= 30
conf[:default_cooldown] ||= 300
conf[:auth] = 'opennebula'
@@ -110,7 +111,11 @@ before do
end
end
##############################################################################
# Cooldown config
##############################################################################
Role.init_default_cooldown(conf[:default_cooldown])
##############################################################################
# LCM thread
+9 -2
View File
@@ -462,7 +462,7 @@ module OpenNebula
diff, cooldown_duration = scale_attributes?(policy)
if diff != 0
cooldown_duration = @body['cooldown'] if cooldown_duration.nil?
cooldown_duration = 0 if cooldown_duration.nil?
cooldown_duration = @@default_cooldown if cooldown_duration.nil?
return [diff, cooldown_duration]
end
@@ -732,7 +732,10 @@ module OpenNebula
# Updates the duration for the next cooldown with the default value
def set_default_cooldown_duration()
set_cooldown_duration(@body['cooldown'].to_i)
cooldown_duration = @body['cooldown']
cooldown_duration = @@default_cooldown if cooldown_duration.nil?
set_cooldown_duration(cooldown_duration)
end
# Sets the cooldown end time from now + the duration set in set_cooldown_duration
@@ -756,6 +759,10 @@ module OpenNebula
return Time.now.to_i >= @body['cooldown_end'].to_i
end
def self.init_default_cooldown(default_cooldown)
@@default_cooldown = default_cooldown
end
def update(template)
set_cardinality(template["cardinality"])
end