Bug 2211394
Summary: | Unable to use Satellite\Foreman ansible modules to create compute_profiles when the Cluster is nested inside a folder under the datacenter of VMware vCenter | ||
---|---|---|---|
Product: | Red Hat Satellite | Reporter: | Sayan Das <saydas> |
Component: | Ansible Collection | Assignee: | Evgeni Golov <egolov> |
Status: | CLOSED ERRATA | QA Contact: | Griffin Sullivan <gsulliva> |
Severity: | high | Docs Contact: | |
Priority: | high | ||
Version: | 6.13.0 | CC: | egolov, ehelms, gsulliva, rlavi |
Target Milestone: | 6.14.0 | Keywords: | Triaged |
Target Release: | Unused | ||
Hardware: | All | ||
OS: | All | ||
Whiteboard: | |||
Fixed In Version: | ansible-collection-redhat-satellite-3.11.0 | Doc Type: | If docs needed, set a value |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2023-11-08 14:19:24 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Sayan Das
2023-05-31 12:03:33 UTC
NOTE: With --> cluster: "{{ vmware_cluster_name }}" and https://github.com/theforeman/foreman-ansible-modules/pull/1615 applied, Now Network related error is gone but it fails to find the storage pod TASK [Create compute profile for satellite] ******************************************************************************************************************************************************************************************* fatal: [127.0.0.1]: FAILED! => changed=false error: |- <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>404 Not Found</title> </head><body> <h1>Not Found</h1> <p>The requested URL was not found on this server.</p> </body></html> msg: 'Error while performing available_storage_pods on compute_resources: 404 Client Error: Not Found for url: https://satellite613.lab.example.com/api/compute_resources/2/available_clusters/PRODUCTION%2FCluster-HomeLab/available_storage_pods' Manual Curl test: # curl -ku admin:RedHat1! "https://satellite613.lab.example.com/api/compute_resources/2/available_clusters/PRODUCTION%2FCluster-HomeLab/available_storage_pods" <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>404 Not Found</title> </head><body> <h1>Not Found</h1> <p>The requested URL was not found on this server.</p> </body></html> # curl -ku admin:RedHat1! "https://satellite613.lab.example.com/api/compute_resources/2/available_clusters/PRODUCTION\Cluster-HomeLab/available_storage_pods" { "total": 1, "subtotal": 1, "page": 1, "per_page": 20, "search": null, "sort": { "by": null, "order": null }, "results": [{"name":"DS-Cluster","id":"group-p1002","capacity":115158810624,"freespace":65284341760,"datacenter":"Home_DC/DC-HomeLab"}] } I believe the same issue would happen for storage_domains as well. Information based on the investigation with engineering team on my setup: Via https://github.com/theforeman/foreman/pull/9383/files and https://github.com/theforeman/hammer-cli-foreman/pull/604/files we got the hammer working with nested-cluster in BZ https://bugzilla.redhat.com/show_bug.cgi?id=1994945 So due to https://github.com/theforeman/foreman/pull/9383/files#diff-4c9e5d9690c2678a2aa9086871b8b0057f0dcbd191112127dfb2b7379020d0dfR298-R300 PRODUCTION/Cluster-HomeLab is called as PRODUCTION%252FCluster-HomeLab and that double escaping works for the API But when FAM\SAM calls the same endpoint directly via REST API PRODUCTION/Cluster-HomeLab is called as PRODUCTION%2FCluster-HomeLab and the call fails. // UPDATE // The new patch now handles the urlescape issue for API https://github.com/theforeman/foreman-ansible-modules/pull/1615/files But even if all the GET calls working fine ( to retrieve the necessary details ) now, The POST request to create the CP fails ~~ TASK [Create compute profile for satellite] ************************************************************************************************│················································································································· fatal: [127.0.0.1]: FAILED! => changed=false │················································································································· error: │················································································································· message: Fog::Vsphere::Compute::NotFound │················································································································· msg: 'Error while performing create on compute_attributes: 500 Server Error: Internal Server Error for url: https://satellite613.lab.examp│················································································································· le.com/api/compute_profiles/11/compute_resources/2/compute_attributes' │················································································································· │················································································································· PLAY RECAP *********************************************************************************************************************************│················································································································· 127.0.0.1 : ok=2 changed=1 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 ~~ 2023-05-31T18:44:11 [I|app|f7b40e0d] Started POST "/api/compute_profiles/11/compute_resources/2/compute_attributes" for 192.168.125.4 at 2023-05-31 18:44:11 +0530 2023-05-31T18:44:11 [I|app|f7b40e0d] Processing by Api::V2::ComputeAttributesController#create as JSON 2023-05-31T18:44:11 [I|app|f7b40e0d] Parameters: {"compute_attribute"=>{"vm_attrs"=>{"cluster"=>"PRODUCTION%2FCluster-HomeLab", "path"=>"/Datacenters/Home_DC/DC-HomeLab/vm/SERVERS/Sayan", "cpus"=>1, "sockets"=>1, "memory_mb"=>204 8, "memoryHotAddEnabled"=>1, "cpuHotAddEnabled"=>1, "guest_id"=>"rhel7_64Guest", "volumes_attributes"=>{"0"=>{"size_gb"=>15, "storage_pod"=>"group-p1002", "thin"=>1, "eager_zero"=>false}}, "interfaces_attributes"=>{"0"=>{"type"=>"V irtualVmxnet3", "network"=>"network-14"}}}}, "apiv"=>"v2", "compute_profile_id"=>"11", "compute_resource_id"=>"2"} 2023-05-31T18:44:17 [W|app|f7b40e0d] Action failed 2023-05-31T18:44:17 [I|app|f7b40e0d] Backtrace for 'Action failed' error (Fog::Vsphere::Compute::NotFound): Fog::Vsphere::Compute::NotFound f7b40e0d | /usr/share/gems/gems/fog-vsphere-3.6.0/lib/fog/vsphere/requests/compute/get_cluster.rb:7:in `get_cluster' f7b40e0d | /usr/share/gems/gems/fog-vsphere-3.6.0/lib/fog/vsphere/models/compute/clusters.rb:15:in `get' f7b40e0d | /usr/share/foreman/app/models/compute_resources/foreman/model/vmware.rb:87:in `block in cluster' f7b40e0d | /usr/share/foreman/app/services/compute_resource_cache.rb:68:in `instance_eval' f7b40e0d | /usr/share/foreman/app/services/compute_resource_cache.rb:68:in `get_uncached_value' f7b40e0d | /usr/share/foreman/app/services/compute_resource_cache.rb:22:in `cache' f7b40e0d | /usr/share/foreman/app/models/compute_resources/foreman/model/vmware.rb:86:in `cluster' f7b40e0d | /usr/share/foreman/app/models/compute_resources/foreman/model/vmware.rb:158:in `block in resource_pools' f7b40e0d | /usr/share/foreman/app/services/compute_resource_cache.rb:68:in `instance_eval' f7b40e0d | /usr/share/foreman/app/services/compute_resource_cache.rb:68:in `get_uncached_value' f7b40e0d | /usr/share/foreman/app/services/compute_resource_cache.rb:22:in `cache' f7b40e0d | /usr/share/foreman/app/models/compute_resources/foreman/model/vmware.rb:157:in `resource_pools' f7b40e0d | /usr/share/foreman/app/models/compute_resources/foreman/model/vmware.rb:680:in `normalize_vm_attrs' Reason: ~~ {"vm_attrs"=>{"cluster"=>"PRODUCTION%2FCluster-HomeLab", "path"=>"/Datacenters/Home_DC/DC-HomeLab/vm/SERVERS/Sayan", ~~ We should not escape the / in cluster value when that is used as payload to create the CP. / UPDATE / With the latest changes introduced in the same PR, Now the CP creation is successful: 2023-05-31T21:22:49 [I|app|3b9a92da] Rendered api/v2/compute_resources/show.json.rabl (Duration: 6568.2ms | Allocations: 299555) 2023-05-31T21:22:49 [I|app|3b9a92da] Completed 200 OK in 6573ms (Views: 6565.6ms | ActiveRecord: 4.3ms | Allocations: 304192) 2023-05-31T21:22:49 [I|app|32a63f77] Started GET "/api/compute_resources/2/available_clusters" for 192.168.125.4 at 2023-05-31 21:22:49 +0530 2023-05-31T21:22:49 [I|app|32a63f77] Processing by Api::V2::ComputeResourcesController#available_clusters as JSON 2023-05-31T21:22:49 [I|app|32a63f77] Parameters: {"apiv"=>"v2", "id"=>"2"} 2023-05-31T21:22:49 [I|app|32a63f77] Rendered api/v2/compute_resources/available_clusters.rabl within api/v2/layouts/index_layout (Duration: 0.4ms | Allocations: 337) 2023-05-31T21:22:49 [I|app|32a63f77] Rendered layout api/v2/layouts/index_layout.json.erb (Duration: 2.6ms | Allocations: 6899) 2023-05-31T21:22:49 [I|app|32a63f77] Completed 200 OK in 6ms (Views: 3.1ms | ActiveRecord: 0.4ms | Allocations: 9444) 2023-05-31T21:22:49 [I|app|2b0d547b] Started GET "/api/compute_resources/2/available_clusters/PRODUCTION%252FCluster-HomeLab/available_storage_pods" for 192.168.125.4 at 2023-05-31 21:22:49 +0530 2023-05-31T21:22:49 [I|app|2b0d547b] Processing by Api::V2::ComputeResourcesController#available_storage_pods as JSON 2023-05-31T21:22:49 [I|app|2b0d547b] Parameters: {"apiv"=>"v2", "id"=>"2", "cluster_id"=>"PRODUCTION%2FCluster-HomeLab"} 2023-05-31T21:22:55 [I|app|2b0d547b] Loaded compute resource data for storage_pods-PRODUCTION/Cluster-HomeLab in 6.202948726 seconds 2023-05-31T21:22:55 [I|app|2b0d547b] Rendered api/v2/compute_resources/available_storage_pods.rabl within api/v2/layouts/index_layout (Duration: 0.4ms | Allocations: 336) 2023-05-31T21:22:55 [I|app|2b0d547b] Rendered layout api/v2/layouts/index_layout.json.erb (Duration: 2.6ms | Allocations: 6897) 2023-05-31T21:22:55 [I|app|2b0d547b] Completed 200 OK in 6210ms (Views: 3.4ms | ActiveRecord: 0.5ms | Allocations: 53302) 2023-05-31T21:22:55 [I|app|64b1bb94] Started GET "/api/compute_resources/2/available_clusters/PRODUCTION%252FCluster-HomeLab/available_networks" for 192.168.125.4 at 2023-05-31 21:22:55 +0530 2023-05-31T21:22:55 [I|app|64b1bb94] Processing by Api::V2::ComputeResourcesController#available_networks as JSON 2023-05-31T21:22:55 [I|app|64b1bb94] Parameters: {"apiv"=>"v2", "id"=>"2", "cluster_id"=>"PRODUCTION%2FCluster-HomeLab"} 2023-05-31T21:23:02 [I|app|64b1bb94] Loaded compute resource data for networks-PRODUCTION/Cluster-HomeLab in 6.208789635 seconds 2023-05-31T21:23:02 [I|app|64b1bb94] Rendered api/v2/compute_resources/available_networks.rabl within api/v2/layouts/index_layout (Duration: 0.4ms | Allocations: 337) 2023-05-31T21:23:02 [I|app|64b1bb94] Rendered layout api/v2/layouts/index_layout.json.erb (Duration: 2.6ms | Allocations: 6899) 2023-05-31T21:23:02 [I|app|64b1bb94] Completed 200 OK in 6215ms (Views: 3.3ms | ActiveRecord: 0.4ms | Allocations: 72666) 2023-05-31T21:23:02 [I|app|ffc64332] Started POST "/api/compute_profiles/12/compute_resources/2/compute_attributes" for 192.168.125.4 at 2023-05-31 21:23:02 +0530 2023-05-31T21:23:02 [I|app|ffc64332] Processing by Api::V2::ComputeAttributesController#create as JSON 2023-05-31T21:23:02 [I|app|ffc64332] Parameters: {"compute_attribute"=>{"vm_attrs"=>{"cluster"=>"PRODUCTION/Cluster-HomeLab", "path"=>"/Datacenters/Home_DC/DC-HomeLab/vm/SERVERS/Sayan", "cpus"=>1, "sockets"=>1, "memory_mb"=>2048, "memoryHotAddEnabled"=>1, "cpuHotAddEnabled"=>1, "guest_id"=>"rhel7_64Guest", "volumes_attributes"=>{"0"=>{"size_gb"=>15, "storage_pod"=>"group-p1002", "thin"=>1, "eager_zero"=>false}}, "interfaces_attributes"=>{"0"=>{"type"=>"VirtualVmxnet3", "network"=>"network-14"}}}}, "apiv"=>"v2", "compute_profile_id"=>"12", "compute_resource_id"=>"2"} 2023-05-31T21:23:08 [I|aud|ffc64332] ComputeAttribute (2) create event on compute_profile_id 12 2023-05-31T21:23:08 [I|aud|ffc64332] ComputeAttribute (2) create event on compute_resource_id 2 2023-05-31T21:23:08 [I|aud|ffc64332] ComputeAttribute (2) create event on name 1 CPUs and 2048 MB memory 2023-05-31T21:23:08 [I|aud|ffc64332] ComputeAttribute (2) create event on vm_attrs {"cluster"=>"PRODUCTION/Cluster-HomeLab", "path"=>"/Datacenters/Home_DC/DC-HomeLab/vm/SERVERS/Sayan", "cpus"=>1, "sockets"=>1, "memory_mb"=>2048, "memoryHotAddEnabled"=>1, "cpuHotAddEnabled"=>1, "guest_id"=>"rhel7_64Guest", "volumes_attributes"=>{"0"=>{"size_gb"=>15, "storage_pod"=>"group-p1002", "thin"=>1, "eager_zero"=>false}}, "interfaces_attributes"=>{"0"=>{"type"=>"VirtualVmxnet3", "network"=>"network-14"}}} 2023-05-31T21:23:08 [I|app|ffc64332] Rendered api/v2/compute_attributes/create.json.rabl (Duration: 8.0ms | Allocations: 61562) 2023-05-31T21:23:08 [I|app|ffc64332] Completed 201 Created in 6218ms (Views: 9.9ms | ActiveRecord: 3.7ms | Allocations: 141139) I confirm that https://github.com/theforeman/foreman-ansible-modules/pull/1615.patch fixes the issue. Verified in 6.14 snap 9 Satellite ansible collection can create a compute profile for a compute resource with a nested cluster in VMware Steps to Reproduce: 1) Setup the nested cluster 2) Create a compute resource for the cluster from step 1 3) Run the playbook in the description of the BZ and edit values as necessary for your cluster Results: Playbook runs successfully for each changing of the nested cluster name. Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (Important: Satellite 6.14 security and bug fix update), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHSA-2023:6818 |