Skip to content

Commit

Permalink
Use #stop_container to stop containerized workers
Browse files Browse the repository at this point in the history
  • Loading branch information
carbonin committed Dec 8, 2017
1 parent f0af72f commit 29166d4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/models/miq_server/worker_management/monitor/stop.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ def stop_worker(worker, monitor_status = :waiting_for_stop, monitor_reason = nil
worker_set_monitor_status(w.pid, monitor_status)
worker_set_monitor_reason(w.pid, monitor_reason)

if w.respond_to?(:terminate)
if w.containerized_worker?
w.stop_container
elsif w.respond_to?(:terminate)
w.terminate
else
w.update_attributes(:status => MiqWorker::STATUS_STOPPING)
Expand Down
4 changes: 4 additions & 0 deletions app/models/miq_worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,10 @@ def self.containerized_worker?
MiqEnvironment::Command.is_container? && supports_container?
end

def containerized_worker?
self.class.containerized_worker?
end

def start_runner
if ENV['MIQ_SPAWN_WORKERS'] || !Process.respond_to?(:fork)
start_runner_via_spawn
Expand Down

0 comments on commit 29166d4

Please sign in to comment.