diff --git a/app/models/miq_server/worker_management/monitor.rb b/app/models/miq_server/worker_management/monitor.rb index c4095e83de8..b764d82fd05 100644 --- a/app/models/miq_server/worker_management/monitor.rb +++ b/app/models/miq_server/worker_management/monitor.rb @@ -78,7 +78,9 @@ def cleanup_orphaned_worker_rows # Hack for schema-less backport(no new system_uid column): # reuse existing guid column to store/retrieve the system_uid, pod name in pods. # https://github.com/ManageIQ/manageiq/pull/20792 - orphaned_rows = miq_workers.where.not(:guid => 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(:guid => current_pods.keys) unless orphaned_rows.empty? _log.warn("Removing orphaned worker rows without corresponding pods: #{orphaned_rows.collect(&:guid).inspect}") orphaned_rows.destroy_all diff --git a/spec/models/miq_server/worker_management/monitor_spec.rb b/spec/models/miq_server/worker_management/monitor_spec.rb index 57b41787945..9290c116fd3 100644 --- a/spec/models/miq_server/worker_management/monitor_spec.rb +++ b/spec/models/miq_server/worker_management/monitor_spec.rb @@ -78,6 +78,12 @@ server.cleanup_orphaned_worker_rows expect(MiqWorker.count).to eq(2) end + + it "skips MiqCockpitWsWorker rows" do + worker.update(:guid => "an_actual_guid", :type => "MiqCockpitWsWorker") + server.cleanup_orphaned_worker_rows + expect(MiqCockpitWsWorker.count).to eq(1) + end end end