From d367ea88fb38fbadc0cf76cefafc83c637a51258 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Mon, 27 May 2013 11:42:38 +0200 Subject: [PATCH] Feature #1852: Service is not stuck in 'scaling' if a failure occurs --- flow/lcm/LifeCycleManager.rb | 6 +++++- flow/models/Service.rb | 10 ++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/flow/lcm/LifeCycleManager.rb b/flow/lcm/LifeCycleManager.rb index b354263365..630cf61847 100644 --- a/flow/lcm/LifeCycleManager.rb +++ b/flow/lcm/LifeCycleManager.rb @@ -90,7 +90,11 @@ class ServiceLCM # TODO: Check scalability rules for roles that are # not scaling now? - if service.all_roles_running? + # The service is moved to RUNNING even if the + # roles scaling ended in failure. Any error is + # handled the next cycle in the RUNNING case + + if !service.any_role_scaling? service.set_state(Service::STATE['RUNNING']) end when Service::STATE['UNKNOWN'] diff --git a/flow/models/Service.rb b/flow/models/Service.rb index 5f9316ba66..b64c6942c6 100644 --- a/flow/models/Service.rb +++ b/flow/models/Service.rb @@ -144,6 +144,16 @@ module OpenNebula return false end + def any_role_scaling?() + @roles.each do |name, role| + if role.state == Role::STATE['SCALING'] + return true + end + end + + return false + end + # Create a new service based on the template provided # @param [String] template_json # @return [nil, OpenNebula::Error] nil in case of success, Error