Skip to content

Commit

Permalink
Merge pull request #20823 from jrafanie/cockpit_is_not_a_pod_worker
Browse files Browse the repository at this point in the history
Cockpit is a monitor thread and is not a pod worker.
  • Loading branch information
gtanzillo authored Nov 18, 2020
2 parents 267ceed + b9f8913 commit 90c2323
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/models/miq_server/worker_management/monitor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ def sync_from_system
def cleanup_orphaned_worker_rows
if podified?
unless current_pods.empty?
orphaned_rows = miq_workers.where.not(:system_uid => current_pods.keys)
# Cockpit is a threaded worker in the orchestrator that spins off a process it monitors and isn't a pod worker.
orphaned_rows = miq_workers.where.not(:type => %w[MiqCockpitWsWorker]).where.not(:system_uid => current_pods.keys)
unless orphaned_rows.empty?
_log.warn("Removing orphaned worker rows without corresponding pods: #{orphaned_rows.collect(&:system_uid).inspect}")
orphaned_rows.destroy_all
Expand Down
6 changes: 6 additions & 0 deletions spec/models/miq_server/worker_management/monitor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@
server.cleanup_orphaned_worker_rows
expect(MiqWorker.count).to eq(2)
end

it "skips MiqCockpitWsWorker rows" do
worker.update(:system_uid => "an_actual_guid", :type => "MiqCockpitWsWorker")
server.cleanup_orphaned_worker_rows
expect(MiqCockpitWsWorker.count).to eq(1)
end
end
end

Expand Down

0 comments on commit 90c2323

Please sign in to comment.