diff --git a/app/models/miq_server/worker_management/monitor.rb b/app/models/miq_server/worker_management/monitor.rb index 0fa710c17bfb..4b6ed549e6f6 100644 --- a/app/models/miq_server/worker_management/monitor.rb +++ b/app/models/miq_server/worker_management/monitor.rb @@ -27,13 +27,7 @@ def monitor_workers cleanup_failed_workers - # Monitor all remaining current worker records - miq_workers.where(:status => MiqWorker::STATUSES_CURRENT_OR_STARTING).each do |worker| - # Push the heartbeat into the database - persist_last_heartbeat(worker) - # Check the worker record for heartbeat timeouts - validate_worker(worker) - end + validate_current_workers do_system_limit_exceeded if self.kill_workers_due_to_resources_exhausted? end @@ -84,6 +78,22 @@ def cleanup_orphaned_worker_rows end end + def validate_current_workers + # When k8s or systemd is operating as the worker monitor then all of the + # worker monitoring (liveness, memory threshold) is handled by those + # systems. Only when workers are run as standalone processes does MiqServer + # have to monitor the workers itself. + return if podified? || systemd? + + # Monitor all remaining current worker records + miq_workers.where(:status => MiqWorker::STATUSES_CURRENT_OR_STARTING).each do |worker| + # Push the heartbeat into the database + persist_last_heartbeat(worker) + # Check the worker record for heartbeat timeouts + validate_worker(worker) + end + end + def cleanup_failed_workers check_not_responding check_pending_stop