-
Bug
-
Resolution: Done
-
Major
-
6.13.0
Description of problem:
The redhat.satellite.compute_profile module works generally great but when the Cluster in VMware environment is actually a Nested Cluster, The compute_profile creation fails with "404 not found" or "500 ISE".
The part that fails is the use of Nested Cluster name to search for Networks or Storage DOmains or Storage pods
Version-Release number of selected component (if applicable):
Satellite 6.11\6.12\6.13
How reproducible:
Always
- Customer tested on 6.11
- Support tested on 6.13
Steps to Reproduce:
1. Configure a VMware vCenter to have Nested Cluster
2. Install a Satellite 6.13 and create a VMware compute resource by hand in Satellite UI for the same vCenter in Step 1.
3. Some information collected from compute resource via hammer:
- hammer compute-resource clusters --id 2
----------|---------------|------------------|-----|--------------------------
ID | NAME | DATACENTER | HOSTS | CLUSTER PATH
----------|---------------|------------------|-----|--------------------------
domain-c20 | Cluster-HomeLab | Home_DC/DC-HomeLab | 2 | PRODUCTION/Cluster-HomeLab
----------|---------------|------------------|-----|--------------------------
- hammer compute-resource networks --id 2
----------|----------|------------------|--------------|-------
ID | NAME | DATACENTER | VIRTUAL SWITCH | VLAN ID
----------|----------|------------------|--------------|-------
network-14 | VM Network | Home_DC/DC-HomeLab | |
----------|----------|------------------|--------------|-------
- hammer compute-resource storage-domains --id 2
------------|---------------
ID | NAME
------------|---------------
datastore-18 | esx11-datastore
datastore-13 | esx12-datastore
------------|---------------
- hammer compute-resource storage-pods --id 2
-----------|----------|------------------
ID | NAME | DATACENTER
-----------|----------|------------------
group-p1002 | DS-Cluster | Home_DC/DC-HomeLab
-----------|----------|------------------
- hammer compute-resource folders --id 2
-----------|-------|----------|----------|------------------------------------------------|----
ID | NAME | PARENT | DATACENTER | PATH | TYPE
-----------|-------|----------|----------|------------------------------------------------|----
group-v5 | vm | DC-HomeLab | DC-HomeLab | /Datacenters/Home_DC/DC-HomeLab/vm | vm
group-v2002 | SERVERS | vm | DC-HomeLab | /Datacenters/Home_DC/DC-HomeLab/vm/SERVERS | vm
group-v2003 | Sayan | SERVERS | DC-HomeLab | /Datacenters/Home_DC/DC-HomeLab/vm/SERVERS/Sayan | vm
group-v22 | vCLS | vm | DC-HomeLab | /Datacenters/Home_DC/DC-HomeLab/vm/vCLS | vm
group-v2001 | vCenter | vm | DC-HomeLab | /Datacenters/Home_DC/DC-HomeLab/vm/vCenter | vm
-----------|-------|----------|----------|------------------------------------------------|----
4. Use the default 3.9.0 version of ansible-collection-redhat-satellite
--> Create a ansible.cfg
--> A playbook to create the CP
- cat compute_profile.yaml
—
- name: create compute profile
hosts: localhost
gather_facts: false
vars:
compute_resource_name: 'My_vCenter'
satellite_compute_profile: 'Test_CP1'
kerberos_id: 'saydas'
compute_network: 'VM Network'
vmware_datacenter: 'Home_DC/DC-HomeLab'
vmware_cluster_name: 'Cluster-HomeLab'
vmware_cluster_full_path: 'PRODUCTION/Cluster-HomeLab'
vmware_storage_pod: 'DS-Cluster'
vmware_folderpath: '/Datacenters/Home_DC/DC-HomeLab/vm/SERVERS/Sayan'
tasks:
- name: Collect Cluster ID
command: bash -c "hammer --csv --no-headers compute-resource clusters --name {{ compute_resource_name }} | cut -d, -f1"
register: cluster_id
- debug: var=storage_pod_id.stdout
- name: Create compute profile for satellite
redhat.satellite.compute_profile:
name: "{{ satellite_compute_profile }}"
compute_attributes: - compute_resource: "{{ compute_resource_name }}"
vm_attrs:
cluster: "{{ vmware_cluster_name }}"
path: "{{ vmware_folderpath }}"
cpus: 1
sockets: 1
memory_mb: 2048
memoryHotAddEnabled: 1
cpuHotAddEnabled: 1
guest_id: rhel7_64Guest
volumes_attributes:
0:
size_gb: 15
storage_pod: "{{ vmware_storage_pod }}"
thin: 1
eager_zero: false
interfaces_attributes:
0:
type: "VirtualVmxnet3"
network: "{{ compute_network }}"
username: "admin"
password: "RedHat1!"
server_url: "https://satellite613.lab.example.com"
validate_certs: true
state: present
--> Repeat the playbook by changing the cluster input i.e.
cluster: "{{ vmware_cluster_name }}"
cluster: "{{ cluster_id.stdout }}"
cluster: "{{ vmware_cluster_full_path }}"
Actual results:
For --> cluster: "{{ vmware_cluster_name }}"
~~
fatal: [127.0.0.1]: FAILED! => changed=false
error:
message: 'Internal Server Error: the server was unable to finish the request. This may be caused by unavailability of some required service, incorrect API call or a server-side bug. There may be more information in the server''s logs.'
msg: 'Error while performing available_networks on compute_resources: 500 Server Error: Internal Server Error for url: https://satellite613.lab.example.com/api/compute_resources/2/available_clusters/Cluster-HomeLab/available_networks'
~~
~~
2023-05-31T16:53:34 [I|app|3ce5b385] Rendered layout api/v2/layouts/index_layout.json.erb (Duration: 2.9ms | Allocations: 6915)
2023-05-31T16:53:34 [I|app|3ce5b385] Completed 200 OK in 6243ms (Views: 3.6ms | ActiveRecord: 0.3ms | Allocations: 53320)
2023-05-31T16:53:34 [I|app|73326310] Started GET "/api/compute_resources/2/available_clusters/Cluster-HomeLab/available_networks" for 192.168.125.4 at 2023-05-31 16:53:34 +0530
2023-05-31T16:53:34 [I|app|73326310] Processing by Api::V2::ComputeResourcesController#available_networks as JSON
2023-05-31T16:53:34 [I|app|73326310] Parameters:
2023-05-31T16:53:40 [W|app|73326310] Action failed
2023-05-31T16:53:40 [I|app|73326310] Backtrace for 'Action failed' error (NoMethodError): undefined method `network' for nil:NilClass
73326310 | /usr/share/gems/gems/fog-vsphere-3.6.0/lib/fog/vsphere/requests/compute/list_networks.rb:21:in `list_networks'
73326310 | /usr/share/gems/gems/fog-vsphere-3.6.0/lib/fog/vsphere/models/compute/networks.rb:10:in `all'
73326310 | /usr/share/foreman/app/models/compute_resources/foreman/model/vmware.rb:152:in `block in networks'
73326310 | /usr/share/foreman/app/services/compute_resource_cache.rb:68:in `instance_eval'
73326310 | /usr/share/foreman/app/services/compute_resource_cache.rb:68:in `get_uncached_value'
73326310 | /usr/share/foreman/app/services/compute_resource_cache.rb:22:in `cache'
73326310 | /usr/share/foreman/app/models/compute_resources/foreman/model/vmware.rb:151:in `networks'
73326310 | /usr/share/foreman/app/models/compute_resources/foreman/model/vmware.rb:173:in `available_networks'
73326310 | /usr/share/foreman/app/controllers/api/v2/compute_resources_controller.rb:144:in `available_networks'
73326310 | /usr/share/gems/gems/actionpack-6.1.7/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
73326310 | /usr/share/gems/gems/actionpack-6.1.7/lib/abstract_controller/base.rb:228:in `process_action'
73326310 | /usr/share/gems/gems/actionpack-6.1.7/lib/action_controller/metal/rendering.rb:30:in `process_action'
~~
For --> cluster: "{{ cluster_id.stdout }}"
~~
fatal: [127.0.0.1]: FAILED! => changed=false
error:
message: 'Internal Server Error: the server was unable to finish the request. This may be caused by unavailability of some required service, incorrect API call or a server-side bug. There may be more information in the server''s logs.'
msg: 'Error while performing available_networks on compute_resources: 500 Server Error: Internal Server Error for url: https://satellite613.lab.example.com/api/compute_resources/2/available_clusters/Cluster-HomeLab/available_networks'
~~
~~
==> /var/log/messages <==
May 31 16:55:11 satellite613 platform-python[2701]: ansible-redhat.satellite.compute_profile Invoked with name=Test_CP1 compute_attributes=[{'compute_resource': 'My_vCenter', 'vm_attrs': {'cluster': 'domain-c20', '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': 'DS-Cluster', 'thin': 1, 'eager_zero': False}}, 'interfaces_attributes': {'0': {'type': 'VirtualVmxnet3', 'network': 'VM Network'}}}}] username=admin password=NOT_LOGGING_PARAMETER server_url=https://satellite613.lab.example.com validate_certs=True state=present updated_name=None
==> /var/log/foreman/production.log <==
2023-05-31T16:55:12 [I|app|a6f3cfc3] Started GET "/api/compute_resources/2/available_clusters/Cluster-HomeLab/available_storage_pods" for 192.168.125.4 at 2023-05-31 16:55:12 +0530
2023-05-31T16:55:12 [I|app|a6f3cfc3] Processing by Api::V2::ComputeResourcesController#available_storage_pods as JSON
2023-05-31T16:55:12 [I|app|a6f3cfc3] Parameters: {"apiv"=>"v2", "id"=>"2", "cluster_id"=>"Cluster-HomeLab"}
2023-05-31T16:55:12 [I|app|a6f3cfc3] Rendered api/v2/compute_resources/available_storage_pods.rabl within api/v2/layouts/index_layout (Duration: 2.4ms | Allocations: 6631)
2023-05-31T16:55:12 [I|app|a6f3cfc3] Rendered layout api/v2/layouts/index_layout.json.erb (Duration: 4.0ms | Allocations: 13233)
2023-05-31T16:55:12 [I|app|a6f3cfc3] Completed 200 OK in 8ms (Views: 4.3ms | ActiveRecord: 0.7ms | Allocations: 15656)
2023-05-31T16:55:12 [I|app|fe4f2309] Started GET "/api/compute_resources/2/available_clusters/Cluster-HomeLab/available_networks" for 192.168.125.4 at 2023-05-31 16:55:12 +0530
2023-05-31T16:55:12 [I|app|fe4f2309] Processing by Api::V2::ComputeResourcesController#available_networks as JSON
2023-05-31T16:55:12 [I|app|fe4f2309] Parameters:
2023-05-31T16:55:18 [W|app|fe4f2309] Action failed
2023-05-31T16:55:18 [I|app|fe4f2309] Backtrace for 'Action failed' error (NoMethodError): undefined method `network' for nil:NilClass
fe4f2309 | /usr/share/gems/gems/fog-vsphere-3.6.0/lib/fog/vsphere/requests/compute/list_networks.rb:21:in `list_networks'
fe4f2309 | /usr/share/gems/gems/fog-vsphere-3.6.0/lib/fog/vsphere/models/compute/networks.rb:10:in `all'
fe4f2309 | /usr/share/foreman/app/models/compute_resources/foreman/model/vmware.rb:152:in `block in networks'
fe4f2309 | /usr/share/foreman/app/services/compute_resource_cache.rb:68:in `instance_eval'
fe4f2309 | /usr/share/foreman/app/services/compute_resource_cache.rb:68:in `get_uncached_value'
fe4f2309 | /usr/share/foreman/app/services/compute_resource_cache.rb:22:in `cache'
fe4f2309 | /usr/share/foreman/app/models/compute_resources/foreman/model/vmware.rb:151:in `networks'
fe4f2309 | /usr/share/foreman/app/models/compute_resources/foreman/model/vmware.rb:173:in `available_networks'
fe4f2309 | /usr/share/foreman/app/controllers/api/v2/compute_resources_controller.rb:144:in `available_networks'
fe4f2309 | /usr/share/gems/gems/actionpack-6.1.7/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
fe4f2309 | /usr/share/gems/gems/actionpack-6.1.7/lib/abstract_controller/base.rb:228:in `process_action'
fe4f2309 | /usr/share/gems/gems/actionpack-6.1.7/lib/action_controller/metal/rendering.rb:30:in `process_action'
fe4f2309 | /usr/share/gems/gems/actionpack-6.1.7/lib/abstract_controller/callbacks.rb:42:in `block in process_action'
~~
Here even if we have used the ID of the cluster, It still maps that back to the name and fails to work.
For --> cluster: "{{ vmware_cluster_full_path }}"
~~
TASK [Create compute profile for satellite] *******************************************************************************************************************************************************************************************
fatal: [127.0.0.1]: FAILED! => changed=false
msg: Could not find clusters 'PRODUCTION/Cluster-HomeLab' on compute resource 'My_vCenter'.
~~
Here Satellite can't even find out the cluster by it's full_path
Expected results:
One of the options should work and get the compute_profile created even if the cluster is nested.
Additional info:
NA