Skip to content

Commit

Permalink
Get this thing back in sync with master.
Browse files Browse the repository at this point in the history
  • Loading branch information
djberg96 committed Jul 8, 2019
1 parent b2de848 commit 51bca56
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/infra_conversion_throttler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,15 @@ def self.start_conversions
_log.debug("- EMS: #{ems.name}")
_log.debug("-- Number of pending jobs: #{jobs.size}")
running = ems.conversion_hosts.inject(0) { |sum, ch| sum + ch.active_tasks.count }
$log&.debug("There are currently #{running} conversion hosts running.")
_log.debug("-- Currently running jobs in EMS: #{running}")
slots = (ems.miq_custom_get('MaxTransformationRunners') || Settings.transformation.limits.max_concurrent_tasks_per_ems).to_i - running
$log&.debug("The maximum number of concurrent tasks for the EMS is: #{slots}.")

if slots <= 0
_log.debug("-- No available slot in EMS. Stopping.")
next
end
_log.debug("-- Available slots in EMS: #{slots}")

jobs.each do |job|
vm_name = job.migration_task.source.name
_log.debug("- Looking for a conversion host for task for #{vm_name}")
Expand Down

0 comments on commit 51bca56

Please sign in to comment.