Skip to content
This repository has been archived by the owner on Aug 29, 2018. It is now read-only.

Enhancement at startup of gears and restart of applications (cgroup) #6261

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 30 additions & 24 deletions node/lib/openshift-origin-node/model/v2_cart_model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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}))
Expand Down Expand Up @@ -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}))
Expand Down Expand Up @@ -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

##
Expand Down