Project

General

Profile

Actions

Bug #32332

closed

undefined method `resource_pools' for nil:NilClass when reading compute-profile

Added by Markus Bucher about 3 years ago. Updated almost 3 years ago.

Status:
Duplicate
Priority:
Normal
Assignee:
-
Category:
Compute resources - VMware
Target version:
-
Difficulty:
Triaged:
No
Fixed in Releases:
Found in Releases:

Description

We use foreman-ansible-modules to create VMWare and Proxmox Compute resources and add a Compute Profile.

We use a playbook that basically does the following (I removed some of the options):

- theforeman.foreman.compute_resource:
    name: VMware
    provider: vmware
    ...
- theforeman.foreman.compute_profile:
    name: Orchahosts-VM
    state: present
    ... 
- theforeman.foreman.compute_attribute:
    compute_resource: VMware
    compute_profile: Orchahosts-VM
    ...
- theforeman.foreman.compute_resource:
    name: "Proxmox" 
    provider: proxmox
    ...
- theforeman.foreman.compute_profile:
    name: "Orchahosts-VM" 
    state: present
    ...
- theforeman.foreman.compute_attribute:
    compute_resource: Proxmox
    compute_profile: Orchahosts-VM
    ...

On the 2nd call to theforeman.foreman.compute_profile we get a 500 from the Foreman. This does not happen always but very often.
I added a shortened excerpt from the production.log. Please let me know if some intermediate information is necessary:

2021-04-15T12:04:26 [I|app|39cbe359] Started POST "/api/compute_resources" for 127.0.0.1 at 2021-04-15 12:04:26 +0200
..
2021-04-15T12:04:27 [I|app|39cbe359] Completed 201 Created in 1081ms (Views: 49.4ms | ActiveRecord: 36.5ms | Allocations: 69753)
2021-04-15T12:04:29 [I|app|e833334c] Started GET "/api/compute_profiles?per_page=4294967296&search=name%3D%22Orchahosts-VM%22" for 127.0.0.1 at 2021-04-15 12:04:29 +0200
..
2021-04-15T12:04:29 [I|app|e833334c] Completed 200 OK in 60ms (Views: 21.7ms | ActiveRecord: 12.0ms | Allocations: 10619)
2021-04-15T12:04:29 [I|app|fb1fae70] Started POST "/api/compute_profiles" for 127.0.0.1 at 2021-04-15 12:04:29 +0200
..
2021-04-15T12:04:29 [I|app|fb1fae70] Completed 201 Created in 90ms (Views: 45.5ms | ActiveRecord: 12.1ms | Allocations: 9960)
2021-04-15T12:04:30 [I|app|cd9b1148] Started GET "/api/compute_resources?per_page=4294967296&search=name%3D%22VMware%22" for 127.0.0.1 at 2021-04-15 12:04:30 +0200
..
2021-04-15T12:04:30 [I|app|cd9b1148] Completed 200 OK in 36ms (Views: 22.2ms | ActiveRecord: 3.5ms | Allocations: 17337)
2021-04-15T12:04:30 [I|app|f2becb49] Started GET "/api/compute_resources/1" for 127.0.0.1 at 2021-04-15 12:04:30 +0200
..
2021-04-15T12:04:30 [I|app|f2becb49] Completed 200 OK in 42ms (Views: 23.6ms | ActiveRecord: 6.4ms | Allocations: 6707)
2021-04-15T12:04:30 [I|app|8aa4119d] Started GET "/api/compute_profiles?per_page=4294967296&search=name%3D%22Orchahosts-VM%22" for 127.0.0.1 at 2021-04-15 12:04:30 +0200
..
2021-04-15T12:04:30 [I|app|8aa4119d] Completed 200 OK in 34ms (Views: 21.5ms | ActiveRecord: 3.2ms | Allocations: 16925)
2021-04-15T12:04:30 [I|app|d83d9bd7] Started POST "/api/compute_profiles/4/compute_resources/1/compute_attributes" for 127.0.0.1 at 2021-04-15 12:04:30 +0200
2021-04-15T12:04:30 [I|app|d83d9bd7] Processing by Api::V2::ComputeAttributesController#create as JSON
2021-04-15T12:04:30 [I|app|d83d9bd7]   Parameters: {"compute_attribute"=>{"vm_attrs"=>{"add_cdrom"=>"0", "resource_pool"=>"Resources", "memory_mb"=>"2048", "cluster"=>"192.168.80.2", "scsi_controller_type"=>"VirtualLsiLogicController", "cpus"=>"1", "hardware_version"=>"Default", "guest_id"=>"otherGuest64", "interfaces_attributes"=>{"0"=>{"type"=>"VirtualVmxnet3", "network"=>"network-16"}}, "memoryHotAddEnabled"=>"0", "path"=>"/Datacenters/DEV/vm/nightly", "cpuHotAddEnabled"=>"0", "corespersocket"=>"1", "annotation"=>"", "volumes_attributes"=>{"0"=>{"size_gb"=>"10", "name"=>"Hard disk", "thin"=>true, "eager_zero"=>false, "datastore"=>"DAS", "mode"=>"persistent"}}}}, "apiv"=>"v2", "compute_profile_id"=>"4", "compute_resource_id"=>"1"}
2021-04-15T12:04:31 [I|aud|d83d9bd7] ComputeAttribute (1) create event on compute_profile_id 4
2021-04-15T12:04:31 [I|aud|d83d9bd7] ComputeAttribute (1) create event on compute_resource_id 1
2021-04-15T12:04:31 [I|aud|d83d9bd7] ComputeAttribute (1) create event on name 1 CPUs and 2048 MB memory
2021-04-15T12:04:31 [I|aud|d83d9bd7] ComputeAttribute (1) create event on vm_attrs {"add_cdrom"=>"0", "resource_pool"=>"Resources", "memory_mb"=>"2048", "cluster"=>"192.168.80.2", "scsi_controller_type"=>"VirtualLsiLogicController", "cpus"=>"1", "hardware_version"=>"Default", "guest_id"=>"otherGuest64", "interfaces_attributes"=>{"0"=>{"type"=>"VirtualVmxnet3", "network"=>"network-16"}}, "memoryHotAddEnabled"=>"0", "path"=>"/Datacenters/DEV/vm/nightly", "cpuHotAddEnabled"=>"0", "corespersocket"=>"1", "annotation"=>"", "volumes_attributes"=>{"0"=>{"size_gb"=>"10", "name"=>"Hard disk", "thin"=>true, "eager_zero"=>false, "datastore"=>"DAS", "mode"=>"persistent"}}}
2021-04-15T12:04:31 [I|app|d83d9bd7]   Rendering api/v2/compute_attributes/create.json.rabl
2021-04-15T12:04:31 [I|app|d83d9bd7] Loaded compute resource data for folders in 0.140401222 seconds
2021-04-15T12:04:31 [I|app|d83d9bd7] Loaded compute resource data for clusters in 0.133485057 seconds
2021-04-15T12:04:31 [I|app|d83d9bd7] Loaded compute resource data for cluster-192.168.80.2 in 0.139161016 seconds
2021-04-15T12:04:31 [I|app|d83d9bd7] Loaded compute resource data for resource_pools-192.168.80.2 in 0.199619694 seconds
2021-04-15T12:04:31 [I|app|d83d9bd7] Loaded compute resource data for datastores in 0.09663945 seconds
2021-04-15T12:04:31 [I|app|d83d9bd7] Loaded compute resource data for networks in 0.093270983 seconds
2021-04-15T12:04:31 [I|app|d83d9bd7]   Rendered api/v2/compute_attributes/create.json.rabl (Duration: 745.4ms | Allocations: 188889)
2021-04-15T12:04:31 [I|app|d83d9bd7] Completed 201 Created in 1017ms (Views: 765.8ms | ActiveRecord: 11.9ms | Allocations: 220676)
2021-04-15T12:04:33 [I|app|94eafdde] Started GET "/api/compute_resources?per_page=4294967296&search=name%3D%22Proxmox%22" for 127.0.0.1 at 2021-04-15 12:04:33 +0200
..
2021-04-15T12:04:33 [I|app|94eafdde] Completed 200 OK in 32ms (Views: 19.9ms | ActiveRecord: 3.1ms | Allocations: 16564)
2021-04-15T12:04:33 [I|app|45f68949] Started GET "/api/locations?per_page=4294967296&search=title%3D%22%C3%84ngineering%22" for 127.0.0.1 at 2021-04-15 12:04:33 +0200
..
2021-04-15T12:04:33 [I|app|45f68949] Completed 200 OK in 35ms (Views: 21.5ms | ActiveRecord: 3.3ms | Allocations: 17072)
2021-04-15T12:04:33 [I|app|4ad6a6a7] Started GET "/katello/api/organizations?per_page=4294967296&search=name%3D%22%C3%84TIX%22" for 127.0.0.1 at 2021-04-15 12:04:33 +0200
..
2021-04-15T12:04:33 [I|app|4ad6a6a7] Completed 200 OK in 23ms (Views: 10.5ms | ActiveRecord: 2.9ms | Allocations: 8403)
2021-04-15T12:04:33 [I|app|d76d6ecd] Started POST "/api/compute_resources" for 127.0.0.1 at 2021-04-15 12:04:33 +0200
..
2021-04-15T12:04:33 [I|app|d76d6ecd] Completed 201 Created in 628ms (Views: 25.5ms | ActiveRecord: 16.1ms | Allocations: 57714)
2021-04-15T12:04:34 [I|app|e4b9804c] Started GET "/api/compute_profiles?per_page=4294967296&search=name%3D%22Orchahosts-VM%22" for 127.0.0.1 at 2021-04-15 12:04:34 +0200
2021-04-15T12:04:34 [I|app|e4b9804c] Processing by Api::V2::ComputeProfilesController#index as JSON
2021-04-15T12:04:34 [I|app|e4b9804c]   Parameters: {"per_page"=>"4294967296", "search"=>"name=\"Orchahosts-VM\"", "apiv"=>"v2"}
2021-04-15T12:04:34 [I|app|e4b9804c]   Rendering api/v2/compute_profiles/index.json.rabl within api/v2/layouts/index_layout
2021-04-15T12:04:34 [I|app|e4b9804c]   Rendered api/v2/compute_profiles/index.json.rabl within api/v2/layouts/index_layout (Duration: 7.1ms | Allocations: 1343)
2021-04-15T12:04:34 [I|app|e4b9804c] Completed 200 OK in 30ms (Views: 17.4ms | ActiveRecord: 2.6ms | Allocations: 11413)
2021-04-15T12:04:34 [I|app|3e539002] Started GET "/api/compute_profiles/4" for 127.0.0.1 at 2021-04-15 12:04:34 +0200
2021-04-15T12:04:34 [I|app|3e539002] Processing by Api::V2::ComputeProfilesController#show as JSON
2021-04-15T12:04:34 [I|app|3e539002]   Parameters: {"apiv"=>"v2", "id"=>"4"}
2021-04-15T12:04:34 [I|app|3e539002]   Rendering api/v2/compute_profiles/show.json.rabl
2021-04-15T12:04:34 [I|app|3e539002]   Rendered api/v2/compute_profiles/show.json.rabl (Duration: 23.5ms | Allocations: 4231)
2021-04-15T12:04:34 [W|app|3e539002] Action failed
2021-04-15T12:04:34 [I|app|3e539002] Backtrace for 'Action failed' error (ActionView::Template::Error): undefined method `resource_pools' for nil:NilClass
 3e539002 | /opt/theforeman/tfm/root/usr/share/gems/gems/fog-vsphere-3.4.0/lib/fog/vsphere/models/compute/cluster.rb:15:in `resource_pools'
 3e539002 | /usr/share/foreman/app/models/compute_resources/foreman/model/vmware.rb:158:in `block in resource_pools'
 3e539002 | /usr/share/foreman/app/services/compute_resource_cache.rb:68:in `instance_eval'
 3e539002 | /usr/share/foreman/app/services/compute_resource_cache.rb:68:in `get_uncached_value'
 3e539002 | /usr/share/foreman/app/services/compute_resource_cache.rb:22:in `cache'
 3e539002 | /usr/share/foreman/app/models/compute_resources/foreman/model/vmware.rb:157:in `resource_pools'
 3e539002 | /usr/share/foreman/app/models/compute_resources/foreman/model/vmware.rb:674:in `normalize_vm_attrs'
 3e539002 | /usr/share/foreman/app/models/compute_attribute.rb:36:in `normalized_vm_attrs'
 3e539002 | /opt/theforeman/tfm/root/usr/share/gems/gems/rabl-0.14.3/lib/rabl/helpers.rb:16:in `data_object_attribute'

Could this have something to do with caching in the VMWare compute-resource?


Related issues 1 (1 open0 closed)

Is duplicate of Foreman - Bug #30548: VMWare compute profile is providing wrong information when using hammer and api.NewActions
Actions #1

Updated by Tomer Brisker almost 3 years ago

  • Is duplicate of Bug #30548: VMWare compute profile is providing wrong information when using hammer and api. added
Actions #2

Updated by Tomer Brisker almost 3 years ago

  • Status changed from New to Duplicate
Actions

Also available in: Atom PDF