From 0fb1bfa28f448d082cdf6c316a90817b7b9ed54c Mon Sep 17 00:00:00 2001 From: IshentRas Date: Thu, 8 Oct 2015 13:20:43 +0100 Subject: [PATCH] Enhancement at startup of gears and restart of applications[C --- .../model/v2_cart_model.rb | 54 ++++++++++--------- 1 file changed, 30 insertions(+), 24 deletions(-) diff --git a/node/lib/openshift-origin-node/model/v2_cart_model.rb b/node/lib/openshift-origin-node/model/v2_cart_model.rb index 74d0f4aa99d..e195ac58c34 100644 --- a/node/lib/openshift-origin-node/model/v2_cart_model.rb +++ b/node/lib/openshift-origin-node/model/v2_cart_model.rb @@ -1510,7 +1510,9 @@ def start_gear(options={}) next if options[:secondary_only] and cartridge.name == primary_cartridge.name next if options[:exclude_web_proxy] and cartridge.web_proxy? - buffer << start_cartridge('start', cartridge, options) + ::OpenShift::Runtime::Utils::Cgroups.new(@container.uuid).boost do + buffer << start_cartridge('start', cartridge, options) + end end else buffer << start_gear(options.merge({secondary_only: true})) @@ -1555,8 +1557,10 @@ def restart_gear(options={}) next if options[:primary_only] and cartridge.name != primary_cartridge.name next if options[:secondary_only] and cartridge.name == primary_cartridge.name next if options[:exclude_web_proxy] and cartridge.web_proxy? - - buffer << start_cartridge('restart', cartridge, options) + + ::OpenShift::Runtime::Utils::Cgroups.new(@container.uuid).boost do + buffer << start_cartridge('restart', cartridge, options) + end end else buffer << restart_gear(options.merge({secondary_only: true})) @@ -1592,35 +1596,37 @@ def start_cartridge(type, cartridge, options={}) options[:user_initiated] = true if not options.has_key?(:user_initiated) options[:hot_deploy] = false if not options.has_key?(:hot_deploy) - cartridge = get_cartridge(cartridge) if cartridge.is_a?(String) + ::OpenShift::Runtime::Utils::Cgroups.new(@container.uuid).boost do + cartridge = get_cartridge(cartridge) if cartridge.is_a?(String) - if not options[:user_initiated] and stop_lock? - return "Not starting cartridge #{cartridge.name} because the application was explicitly stopped by the user" - end + if not options[:user_initiated] and stop_lock? + return "Not starting cartridge #{cartridge.name} because the application was explicitly stopped by the user" + end - if cartridge.name == primary_cartridge.name - if options[:user_initiated] - FileUtils.rm_f(stop_lock) + if cartridge.name == primary_cartridge.name + if options[:user_initiated] + FileUtils.rm_f(stop_lock) + + # Unidle the application, preferring to use the privileged operation if possible + frontend = FrontendHttpServer.new(@container) + if Process.uid == @container.uid + frontend.unprivileged_unidle + else + frontend.unidle + end - # Unidle the application, preferring to use the privileged operation if possible - frontend = FrontendHttpServer.new(@container) - if Process.uid == @container.uid - frontend.unprivileged_unidle - else - frontend.unidle end + @state.value = State::STARTED + end + if options[:hot_deploy] + output = "Not starting cartridge #{cartridge.name} because hot deploy is enabled" + options[:out].puts(output) if options[:out] + return output end - @state.value = State::STARTED - end - if options[:hot_deploy] - output = "Not starting cartridge #{cartridge.name} because hot deploy is enabled" - options[:out].puts(output) if options[:out] - return output + do_control(type, cartridge, options) end - - do_control(type, cartridge, options) end ##