Bug 1449834 - RedHat Domain method vmware_best_fit_with scope: prov.check_quota(:active_provisions) returns no data for the currently active provision tasks/requests
Summary: RedHat Domain method vmware_best_fit_with scope: prov.check_quota(:active_pro...
Keywords:
Status: CLOSED DUPLICATE of bug 1456819
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Automate
Version: 5.7.0
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: GA
: cfme-future
Assignee: Lucy Fu
QA Contact: Aziza Karol
URL:
Whiteboard: quota:provision
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-05-10 20:43 UTC by Dustin Scott
Modified: 2017-09-11 05:36 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-09-07 18:17:40 UTC
Category: ---
Cloudforms Team: ---
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Dustin Scott 2017-05-10 20:43:40 UTC
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:

Comment 3 Lucy Fu 2017-09-07 18:17:40 UTC

*** This bug has been marked as a duplicate of bug 1456819 ***


Note You need to log in before you can comment on or make changes to this bug.