Description of problem: In the vmware_best_fit_with_scope method, there is a bit of code which should pull all of the active provision request data (important for multiple provisions) in order to help to determine how to properly place a provisioned system: prov.check_quota(:active_provision) However, the data returned is as follows: [----] I, [2017-05-10T08:25:14.327723 #6088:10d26d0] INFO -- : Q-task_id([miq_provision_1000000002472]) <AEMethod vmware_best_fit_with_scope> Active Provision Data inspect: [{:count=>0, :memory=>0, :cpu=>0, :storage=>0, :ids=>[], :class_name=>"MiqProvisionRequest", :active=>{:class_name=>"MiqProvision", :ids=>[], :storage_by_id=>{1000000000024=>0}, :memory_by_host_id=>{}, :cpu_by_host_id=>{}, :vms_by_storage_id=>{}}}] [----] I, [2017-05-10T08:25:14.328252 #6088:10d26d0] INFO -- : Q-task_id([miq_provision_1000000002472]) <AEMethod vmware_best_fit_with_scope> Active provision space requirement: [0] [----] I, [2017-05-10T08:25:14.331881 #6088:10d26d0] INFO -- : Q-task_id([miq_provision_1000000002472]) <AEMethod vmware_best_fit_with_scope> Valid Datastore: [VMStore_DEVD1_CloudForms_LUN04_NR], enough free space for VM -- Available: [225950302208], Needs: [47244640256] [----] I, [2017-05-10T08:25:14.338285 #6088:10d26d0] INFO -- : Q-task_id([miq_provision_1000000002472]) <AEMethod vmware_best_fit_with_scope> Active Provision Data inspect: [{:count=>0, :memory=>0, :cpu=>0, :storage=>0, :ids=>[], :class_name=>"MiqProvisionRequest", :active=>{:class_name=>"MiqProvision", :ids=>[], :storage_by_id=>{1000000000024=>0, 1000000000025=>0}, :memory_by_host_id=>{}, :cpu_by_host_id=>{}, :vms_by_storage_id=>{}}}] [----] I, [2017-05-10T08:25:14.338831 #6088:10d26d0] INFO -- : Q-task_id([miq_provision_1000000002472]) <AEMethod vmware_best_fit_with_scope> Active provision space requirement: [0] From the /var/www/miq/vmdb/app/models/mixins/miq_provision_quota_mixin.rb: def quota_find_active_prov_request(_options) prov_req_ids = [] MiqQueue .where(:method_name => 'create_provision_instances', :state => 'dequeue', :class_name => 'MiqProvisionRequest') .each do |q| prov_req_ids << q.instance_id end prov_ids = [] MiqQueue .where(:method_name => 'deliver', :state => %w(ready dequeue), :class_name => 'MiqAeEngine') .where("task_id like ?", '%miq_provision_%') .each do |q| if q.args args = q.args.first prov_ids << args[:object_id] if args[:object_type] == 'MiqProvision' && !args[:object_id].blank? end end prov_req_ids += MiqProvision.where(:id => prov_ids).pluck("miq_request_id") MiqProvisionRequest.where(:id => prov_req_ids.compact.uniq) end When running multiple provisions, the above method returns an empty array. Version-Release number of selected component (if applicable): 5.7.1.3 How reproducible: Always Steps to Reproduce: 1. Provision multiple VMs at once (either via number_of_vms option or multiple separate requests) 2. Ensure that the vmware_best_fit_with_scope method is used for placement 3. Ensure Placement is set to automatic 4. Do one of the following while provisioning: a) Uncomment the following line in vmware_best_fit_with_scope and tail the automation.log $evm.log(:info, "Active Provision Data inspect: [#{active_prov_data.inspect}]") b) Run the following from the rails console: prov_req_ids = [] MiqQueue.where(:method_name => 'create_provision_instances', :state => 'dequeue', :class_name => 'MiqProvisionRequest').each do |q| prov_req_ids << q.instance_id end prov_ids = [] MiqQueue.where(:method_name => 'deliver', :state => %w(ready dequeue), :class_name => 'MiqAeEngine').where("task_id like ?", '%miq_provision_%').each do |q| if q.args args = q.args.first prov_ids << args[:object_id] if args[:object_type] == 'MiqProvision' && !args[:object_id].blank? end end prov_req_ids += MiqProvision.where(:id => prov_ids).pluck("miq_request_id") active = MiqProvisionRequest.where(:id => prov_req_ids.compact.uniq) active.inspect Actual results: Either method in Step 4 above never returns any data, which tells me that the active provision data is not being accounted for in the stock auto placement method (vmware_best_fit_with_scope) Expected results: We get usable data. Additional info:
*** This bug has been marked as a duplicate of bug 1456819 ***