Project

General

Profile

Bug #35438

hammer cannot use the cluster name or id as valid input when clusters are residing inside folders and fails with error fog not found

Added by Chris Roberts 3 months ago. Updated 8 days ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Compute resources - VMware
Target version:
Fixed in Releases:
Found in Releases:
Red Hat JIRA:

Description

Description of problem:

When Clusters are residing in a folder inside datacenter, hammer cannot properly use the full_path\id\name of that cluster as an acceptable value for any operations

But Satellite UI can properly detect the full_path of the cluster and work with the same without any issues.

Version-Release number of selected component (if applicable):
Satellite 6.9 [ as well as Satellite 6.10 ]

How reproducible:
100% when certain conditions are met

DC: | Folder1
: Cluster1 | Folder2
: Cluster2

Steps to Reproduce:

1. Ensure that in vCenter we have DC, inside DC we have a folder and inside folder we have a cluster. So full path of the cluster would be Folder1/Cluster1 i.e. in my example OT_Non-Oracle/OT_Non_Oracle_HA

2. Create a Compute resource for that vCenter and DC

3. Create two compute profiles named CP1 and CP2.

4. Configure all compute attributes for CP1 from Satellite UI

5. Configure all compute attributes for CP2 using hammer.

Actual results:

Step 5: UI is able to create the cluster without any issues and "OT_Non-Oracle/OT_Non_Oracle_HA" is an acceptable value there for cluster

2021-08-13T14:58:38 [I|aud|9f6d1abb] ComputeAttribute (43) create event on vm_attrs {"cpus"=>"2", "corespersocket"=>"2", "memory_mb"=>"4096", "firmware"=>"efi", "cluster"=>"OT_Non-Oracle/OT_Non_Oracle_HA", "resource_pool"=>"Resources", "path"=>"/Datacenters/TC/vm/OT Non-Oracle/Linux", "guest_id"=>"rhel8_64Guest", "hardware_version"=>"Default", "memoryHotAddEnabled"=>"0", "cpuHotAddEnabled"=>"0", "add_cdrom"=>"0", "boot_order"=>["disk", "network"], "annotation"=>"", "scsi_controllers"=>[{"type"=>"ParaVirtualSCSIController", "key"=>1000}, {"type"=>"ParaVirtualSCSIController", "key"=>1001}], "interfaces_attributes"=>{"0"=>{"type"=>"VirtualVmxnet3", "network"=>"network-1711"}, "1628859505113"=>{"type"=>"VirtualVmxnet3", "network"=>"dvportgroup-1685"}, "1628859506738"=>{"type"=>"VirtualVmxnet3", "network"=>"network-158"}}, "volumes_attributes"=>{"0"=>{"thin"=>true, "name"=>"Hard disk", "mode"=>"persistent", "controller_key"=>1000, "size_gb"=>2, "datastore"=>"AFF_ALL_TOM2Y820_OT_LINUX_M_42D", "storage_pod"=>nil}, "1"=>{"size_gb"=>60, "datastore"=>"AFF_ALL_TOM2Y820_OT_LINUX_M_42D", "storage_pod"=>nil, "thin"=>true, "eager_zero"=>false, "name"=>"Hard disk", "mode"=>"persistent", "controller_key"=>1000}, "2"=>{"size_gb"=>4, "datastore"=>"AFF_ALL_TOM2Y820_OT_LINUX_M_42D", "storage_pod"=>nil, "thin"=>true, "eager_zero"=>false, "name"=>"Hard disk", "mode"=>"persistent", "controller_key"=>1001}}}

Step 6: hammer fails to find the cluster itself when using "OT_Non-Oracle/OT_Non_Oracle_HA"

  1. /usr/bin/hammer compute-profile values create --compute-profile-id 52 --compute-resource-id 1 '--compute-attributes={"cpus":2,"corespersocket":2,"memory_mb":4096,"firmware":"efi","resource_pool":"Resources","cluster":"OT_Non_Oracle/OT_Non_Oracle_HA","guest_id":"rhel8_64Guest","path":"/Datacenters/TC/vm/OT Non-Oracle/Linux","hardware_version":"Default","memoryHotAddEnabled":0,"cpuHotAddEnabled":0,"add_cdrom":0,"boot_order":["disk","network"],"scsi_controllers":[{"type":"ParaVirtualSCSIController","key":1000},{"type":"ParaVirtualSCSIController","key":1001}]}'

Could not set the compute profile attributes:
Fog::Vsphere::Compute::NotFound

And backend log always and everytime suggests that Satellite cannot find the cluster details . Sharing one example:
~
2021-08-12T14:22:54 [I|app|4da8f3cc] Backtrace for 'Action failed' error (ActionView::Template::Error): Fog::Vsphere::Compute::NotFound
4da8f3cc | /opt/theforeman/tfm/root/usr/share/gems/gems/fog-vsphere-3.4.0/lib/fog/vsphere/requests/compute/get_cluster.rb:7:in `get_cluster'
4da8f3cc | /opt/theforeman/tfm/root/usr/share/gems/gems/fog-vsphere-3.4.0/lib/fog/vsphere/models/compute/clusters.rb:17:in `get'
4da8f3cc | /usr/share/foreman/app/models/compute_resources/foreman/model/vmware.rb:87:in `block in cluster'
4da8f3cc | /usr/share/foreman/app/services/compute_resource_cache.rb:68:in `instance_eval'
4da8f3cc | /usr/share/foreman/app/services/compute_resource_cache.rb:68:in `get_uncached_value'
4da8f3cc | /usr/share/foreman/app/services/compute_resource_cache.rb:22:in `cache'
4da8f3cc | /usr/share/foreman/app/models/compute_resources/foreman/model/vmware.rb:86:in `cluster'
4da8f3cc | /usr/share/foreman/app/models/compute_resources/foreman/model/vmware.rb:158:in `block in resource_pools'
4da8f3cc | /usr/share/foreman/app/services/compute_resource_cache.rb:68:in `instance_eval'
4da8f3cc | /usr/share/foreman/app/services/compute_resource_cache.rb:68:in `get_uncached_value'
4da8f3cc | /usr/share/foreman/app/services/compute_resource_cache.rb:22:in `cache'
4da8f3cc | /usr/share/foreman/app/models/compute_resources/foreman/model/vmware.rb:157:in `resource_pools'
4da8f3cc | /usr/share/foreman/app/models/compute_resources/foreman/model/vmware.rb:674:in `normalize_vm_attrs'
4da8f3cc | /usr/share/foreman/app/models/compute_attribute.rb:36:in `normalized_vm_attrs'
4da8f3cc | /opt/theforeman/tfm/root/usr/share/gems/gems/rabl-0.14.3/lib/rabl/helpers.rb:16:in `data_object_attribute'
~

Expected results:

hammer will be able to use "OT_Non_Oracle/OT_Non_Oracle_HA" as a valid value for cluster attrobute.

Additional info:

Hammer cannot even see the full_path of cluster as we can see below.

  1. hammer compute-resource clusters --id 1
    --------------|-----------------------
    ID | NAME
    --------------|-----------------------
    ...
    domain-c1694 | OT_Non_Oracle_HA
    domain-c208 | OT_Oracle_HA
    ...

And none of the name or ID works here. Normally it's expected that we will be able to use the name of cluster and that works for me but fails under Folder1\Cluster1 situation.

hammer compute-resource resource-pools --cluster-id OT_Oracle_HA --id 1
Fog::Vsphere::Compute::NotFound

hammer compute-resource resource-pools --cluster-id domain-c1694 --id 1
Fog::Vsphere::Compute::NotFound

  1. hammer compute-resource resource-pools --cluster-id "OT_Non_Oracle/OT_Non_Oracle_HA" --id 1
    404 Not Found

Associated revisions

Revision 2bdd1979 (diff)
Added by Chris Roberts 3 months ago

Fixes #35438 - Unescape cluster on compute resource controller

The webui uses a different controller than hammer does, we don't allow slashes in Apache so this allows nested clusters to be found when using hammer. Also updated various rabl files for better user experience in hammer list commands(seperate pr to that repo)

History

#1 Updated by The Foreman Bot 3 months ago

  • Status changed from Assigned to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/9383 added

#2 Updated by Chris Roberts 3 months ago

  • Bugzilla link set to 1994945

#3 Updated by The Foreman Bot 3 months ago

  • Fixed in Releases 3.5.0 added

#4 Updated by Chris Roberts 3 months ago

  • Status changed from Ready For Testing to Closed

#5 Updated by The Foreman Bot 2 months ago

  • Pull request https://github.com/theforeman/foreman/pull/9452 added

#6 Updated by The Foreman Bot 2 months ago

  • Pull request https://github.com/theforeman/foreman/pull/9451 added

#7 Updated by The Foreman Bot 2 months ago

  • Fixed in Releases 3.3.1 added

#8 Updated by The Foreman Bot 2 months ago

  • Fixed in Releases 3.4.1 added

#9 Updated by Ewoud Kohl van Wijngaarden 8 days ago

  • Triaged changed from No to Yes

Also available in: Atom PDF