Project

General

Profile

Bug #31883

"HTTP response code is 404. The response body is empty." when trying to view an oVirt Compute Resource

Added by Evgeni Golov 4 months ago. Updated 3 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Compute resources - oVirt
Target version:
-
Difficulty:
Triaged:
No
Bugzilla link:
Fixed in Releases:
Found in Releases:

Description

Ohai,

when you create an oVirt CR, and then add a Compute Profile to it, that points to a non-existing cluster, you cannot view the CR via the API anymore and only get a HTTP response code is 404. The response body is empty.

Steps to reproduce:
  1. Create an oVirt CR (UI, API, whatever)
  2. Create a Compute Profile (API POST {"compute_profile"=>{"name"=>"lol-nope"}} to /api/compute_profiles)
  3. Set Compute Attributes for that Profile to have an invalid Cluster (API POST {"compute_attribute"=>{"vm_attrs"=>{"cluster"=>"lol-nope"}}, "compute_profile_id"=>"4", "compute_resource_id"=>"1"} to /api/compute_profiles/4/compute_resources/1/compute_attributes)
  4. Try to fetch /api/compute_resources/1

Actual Result:

{
  "error": {"message":"HTTP response code is 404. The response body is empty."}
}

Expected Result:
The actual API respinse

Additional Info:
This ought to be fixed in #25281, but seems it wasn't completely?


Related issues

Related to Foreman - Bug #25281: Unable to provision a host, if RHV resource created through CLIClosed
Related to Foreman - Tracker #27680: API bugs that need workarounds in foreman-ansible-modulesNew

Associated revisions

Revision 9d44364c (diff)
Added by yifat makias 3 months ago

Fixes #31883 - Validate compute attributes before API creation

History

#1 Updated by Evgeni Golov 4 months ago

  • Related to Bug #25281: Unable to provision a host, if RHV resource created through CLI added

#2 Updated by Evgeni Golov 4 months ago

  • Related to Tracker #27680: API bugs that need workarounds in foreman-ansible-modules added

#3 Updated by Evgeni Golov 4 months ago

The same error also happens if you want to pull the Compute Profile directly via the API: GET /api/compute_profiles/6

#4 Updated by yifat makias 4 months ago

When I try to reproduce this error I received the error you got in the third step:
Set Compute Attributes for that Profile to have an invalid Cluster (API POST {"compute_attribute"=>{"vm_attrs"=>{"cluster"=>"lol-nope"}}, "compute_profile_id"=>"4", "compute_resource_id"=>"1"} to /api/compute_profiles/4/compute_resources/1/compute_attributes)

which I think is ok because it shouldn't create the compute attributes with a cluster that does not exist.
is there something missing in the steps or can I close this issue?

#5 Updated by Evgeni Golov 4 months ago

Hah, my reproducer steps weren't exact enough. Sorry!

So yeah, when I POST the last step, I do get an error, indeed:

# curl -u admin:changeme -XPOST -H 'Content-Type: application/json' -H 'Accept: application/json' -d'{"compute_attribute":{"vm_attrs":{"cluster":"lol-nope"}},"compute_profile_id":"4","compute_resource_id":"1"}' -k https://localhost/api/compute_profiles/4/compute_resources/1/compute_attributes
{
  "error": {"message":"HTTP response code is 404. The response body is empty."}
}

But! The CR is now broken and can't be accessed:

# curl -u admin:changeme -H 'Accept: application/json' -k https://localhost/api/compute_resources/1/
{
  "error": {"message":"HTTP response code is 404. The response body is empty."}
}

#6 Updated by The Foreman Bot 4 months ago

  • Assignee set to yifat makias
  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/8339 added

#7 Updated by The Foreman Bot 3 months ago

  • Fixed in Releases 2.5.0 added

#8 Updated by yifat makias 3 months ago

  • Status changed from Ready For Testing to Closed

Also available in: Atom PDF