From bf0245d17c2150dab4ef7dd30c8a7b77204cd8e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Wed, 12 Jun 2013 17:54:18 +0200 Subject: [PATCH] Feature #2118: Add cooldown time after a set-cardinality action --- flow/models/Role.rb | 5 +++++ flow/models/Service.rb | 2 ++ 2 files changed, 7 insertions(+) diff --git a/flow/models/Role.rb b/flow/models/Role.rb index 91d8bd8daf..a665c71f20 100644 --- a/flow/models/Role.rb +++ b/flow/models/Role.rb @@ -730,6 +730,11 @@ module OpenNebula @body['cooldown_duration'] = cooldown_duration.to_i end + # Updates the duration for the next cooldown with the default value + def set_default_cooldown_duration() + set_cooldown_duration(@body['cooldown'].to_i) + end + # Sets the cooldown end time from now + the duration set in set_cooldown_duration # @return [true, false] true if the cooldown duration is bigger than 0 def apply_cooldown_duration() diff --git a/flow/models/Service.rb b/flow/models/Service.rb index 081f6ce29f..1d0d56123b 100644 --- a/flow/models/Service.rb +++ b/flow/models/Service.rb @@ -345,6 +345,8 @@ module OpenNebula role.set_state(Role::STATE['SCALING']) + role.set_default_cooldown_duration() + self.set_state(Service::STATE['SCALING']) return self.update end