diff --git a/app/models/mixins/miq_request_mixin.rb b/app/models/mixins/miq_request_mixin.rb index 9b62eb886b4c..be25ecc3d63e 100644 --- a/app/models/mixins/miq_request_mixin.rb +++ b/app/models/mixins/miq_request_mixin.rb @@ -185,9 +185,11 @@ def dialog_zone zone end + LOG_SERVERS_LIMIT = 10 def mark_execution_servers options[:executed_on_servers] ||= [] options[:executed_on_servers] << MiqServer.my_server.id + options[:executed_on_servers].shift if options[:executed_on_servers].size > LOG_SERVERS_LIMIT update_attributes(:options => options) end end diff --git a/spec/models/service_template_provision_task_spec.rb b/spec/models/service_template_provision_task_spec.rb index f4e0f7e7a9b1..6a11b05ceb55 100644 --- a/spec/models/service_template_provision_task_spec.rb +++ b/spec/models/service_template_provision_task_spec.rb @@ -299,6 +299,13 @@ def service_resource_id(index, scaling_max) @task_0.mark_execution_servers expect(@task_0.options[:executed_on_servers]).to eq([server.id, server.id]) end + + it "limits number of logged servers to the last 10 (defined in MiqRequestMixin::LOG_SERVERS_LIMIT)" do + @task_0.options[:executed_on_servers] = Array.new(MiqRequestMixin::LOG_SERVERS_LIMIT) + @task_0.mark_execution_servers + + expect(@task_0.options[:executed_on_servers].size).to eq(MiqRequestMixin::LOG_SERVERS_LIMIT) + end end end end