Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
DescriptionAshfaqur Rahaman
2021-08-16 10:53:33 UTC
Description of problem:
There is no validation for "Cluster ID" when we create compute profile via hammer. Satellite tries to create compute profile with wrong cluster id and eventually it breaks compute resource. All following compute profile creation via hammer for that compute resource fails with this error :
----
Could not update the compute profile attributes:
Fog::Vsphere::Compute::NotFound
-----
Version-Release number of selected component (if applicable):
6.9
How reproducible:
100%
Steps to Reproduce:
1. Create compute profile :
# hammer compute-profile create --name test04hammer
# hammer compute-profile list
---|-----------------
ID | NAME
---|-----------------
16 | test04hammer
---|-----------------
# hammer compute-resource list
---|----------------------------------|-----------------------
ID | NAME | PROVIDER
---|----------------------------------|-----------------------
27 | vcenter@profile | VMware
---|----------------------------------|-----------------------
# hammer compute-resource clusters --id 27
--------------|----------------
ID | NAME
--------------|----------------
domain-c14272 | Test-DC-Cluster
--------------|----------------
2. Create compute profile with wrong Cluster id : (Test-DC-Cluster-1 instead of Test-DC-Cluster)
# hammer compute-profile values create --compute-profile-id 16 --compute-resource-id 27 --compute-attributes='{"cluster":"Test-DC-Cluster-1", "resource_pool":"Resources"}'
Could not set the compute profile attributes:
Fog::Vsphere::Compute::NotFound
(It fails with above error)
3. Try to update it with correct cluster id :
# hammer compute-profile values update --compute-profile-id 16 --compute-resource-id 27 --compute-attributes='{"cluster":"Test-DC-Cluster", "resource_pool":"Resources"}'
Could not update the compute profile attributes:
Fog::Vsphere::Compute::NotFound
(same error)
Try creating a new profile with this compute resource, it will fail with same error.
//workaround//
4. We can remove it via foreman-rake
# foreman-rake console
irb(main):001:0> ComputeAttribute.where(compute_resource_id: 27, compute_profile_id: 16).first.destroy
=> #<ComputeAttribute id: 26, compute_profile_id: 16, compute_resource_id: 27, name: "1 CPUs and 2048 MB memory", vm_attrs: {"cluster"=>"Test-DC-Cluster-1", "resource_pool"=>"Resources"}, created_at: "2021-08-16 10:06:30", updated_at: "2021-08-16 10:06:30">
irb(main):002:0> pp ComputeAttribute.where(compute_resource_id: 27, compute_profile_id: 16)
[]
=> #<ActiveRecord::Relation []>
irb(main):003:0>
5. Once destroyed, try create again :
# hammer compute-profile values create --compute-profile-id 16 --compute-resource-id 27 --compute-attributes='{"cluster":"Test-DC-Cluster", "resource_pool":"Resources"}'
Compute profile attributes are set.
Actual results:
--
Could not update the compute profile attributes:
Fog::Vsphere::Compute::NotFound
--
Expected results:
1. It should validated the cluster id and give error if the id is not correct.
2. With correct cluster id , it should get created
Additional info:
One more way to recover the compute-resource after a bad hammer execution would be:
* Clear the cache of compute-resource from UI and if needed disable it.
* Delete the bad compute profile:
# hammer compute-profile delete --id 16
* Clear foreman's own cache:
# foreman-rake tmp:cache:clear
Since there is no validation for cluster ID present, the hammer will always fail to detect full cluster-path when Clusters are in fact inside a folder i.e.
DC:
| Folder1
: Cluster1
| Folder2
: Cluster2
When I am trying to create a compute-profile from UI, then the Cluster field shows me the name of clusters in this way "Folder1\Cluster1" and gets saved in that way only. And it's working fine.
On the other hand if i try to see the same cluster list via hammer command, I get to see only the name of the cluster but not the folder appended.
hammer> compute-resource clusters --id 1
--------------|-----------------------
ID | NAME
--------------|-----------------------
...
domain-c1694 | Cluster1
Description of problem: There is no validation for "Cluster ID" when we create compute profile via hammer. Satellite tries to create compute profile with wrong cluster id and eventually it breaks compute resource. All following compute profile creation via hammer for that compute resource fails with this error : ---- Could not update the compute profile attributes: Fog::Vsphere::Compute::NotFound ----- Version-Release number of selected component (if applicable): 6.9 How reproducible: 100% Steps to Reproduce: 1. Create compute profile : # hammer compute-profile create --name test04hammer # hammer compute-profile list ---|----------------- ID | NAME ---|----------------- 16 | test04hammer ---|----------------- # hammer compute-resource list ---|----------------------------------|----------------------- ID | NAME | PROVIDER ---|----------------------------------|----------------------- 27 | vcenter@profile | VMware ---|----------------------------------|----------------------- # hammer compute-resource clusters --id 27 --------------|---------------- ID | NAME --------------|---------------- domain-c14272 | Test-DC-Cluster --------------|---------------- 2. Create compute profile with wrong Cluster id : (Test-DC-Cluster-1 instead of Test-DC-Cluster) # hammer compute-profile values create --compute-profile-id 16 --compute-resource-id 27 --compute-attributes='{"cluster":"Test-DC-Cluster-1", "resource_pool":"Resources"}' Could not set the compute profile attributes: Fog::Vsphere::Compute::NotFound (It fails with above error) 3. Try to update it with correct cluster id : # hammer compute-profile values update --compute-profile-id 16 --compute-resource-id 27 --compute-attributes='{"cluster":"Test-DC-Cluster", "resource_pool":"Resources"}' Could not update the compute profile attributes: Fog::Vsphere::Compute::NotFound (same error) Try creating a new profile with this compute resource, it will fail with same error. //workaround// 4. We can remove it via foreman-rake # foreman-rake console irb(main):001:0> ComputeAttribute.where(compute_resource_id: 27, compute_profile_id: 16).first.destroy => #<ComputeAttribute id: 26, compute_profile_id: 16, compute_resource_id: 27, name: "1 CPUs and 2048 MB memory", vm_attrs: {"cluster"=>"Test-DC-Cluster-1", "resource_pool"=>"Resources"}, created_at: "2021-08-16 10:06:30", updated_at: "2021-08-16 10:06:30"> irb(main):002:0> pp ComputeAttribute.where(compute_resource_id: 27, compute_profile_id: 16) [] => #<ActiveRecord::Relation []> irb(main):003:0> 5. Once destroyed, try create again : # hammer compute-profile values create --compute-profile-id 16 --compute-resource-id 27 --compute-attributes='{"cluster":"Test-DC-Cluster", "resource_pool":"Resources"}' Compute profile attributes are set. Actual results: -- Could not update the compute profile attributes: Fog::Vsphere::Compute::NotFound -- Expected results: 1. It should validated the cluster id and give error if the id is not correct. 2. With correct cluster id , it should get created Additional info: