Bug 1702636 - [Kubevirt-Foreman] compute resource organisation errors
Summary: [Kubevirt-Foreman] compute resource organisation errors
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Compute Resources - CNV
Version: 6.6.0
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: Unspecified
Assignee: Shira Maximov
QA Contact: Lukáš Hellebrandt
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-04-24 10:21 UTC by Vatsal Parekh
Modified: 2019-04-28 14:15 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-04-28 14:15:11 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Vatsal Parekh 2019-04-24 10:21:11 UTC
Description of problem:
When trying to create a host via API, i get this error even if the compute resource id is correct and shows under correct org
```
{
    "error": {
        "id": null,
        "errors": {
            "interfaces.compute_resource_id": [
                "is not defined for host's organization"
            ]
        },
        "full_messages": [
            "Interfaces.compute resource is not defined for host's organization"
        ]
    }
}
```

If I edit the Organisation and select 'All compute resource' under Compute resource section, and create the host again then it does not complain about this. 
But now the Create host from UI shows the error `	
with id 1 doesn't exist or is not assigned to proper organisation and/or location`

The thing to note is that the compute resource already shows under the org, and still shows this behaviour 

Version-Release number of selected component (if applicable):
nightly+plugin master

How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:
Wrong errors regarding the organisation even when it is part of the selected org

Expected results:


Additional info:

Comment 3 Vatsal Parekh 2019-04-24 10:25:46 UTC
REQUEST SENT:
{  "location_id" : "1",
  "organization_id" : "2",
  "host" : {
    "name" : "test-api-host",
    "location_id" : 1,
    "organization_id" : 1,
   
    "compute_resource_id" : 1,
    "provision_method":"build",
    "compute_attributes" : {
      "cores" : "1",
      "memory": 1024,
      "volumes_attributes": {
  "0": { "storage_class": "gluster-default-volume", "capacity": "1"}
}
    },
    "operatingsystem_id": 1,
    "architecture_id" : 1,
    "interfaces_attributes": {
       "0" : {
       	"domain_id" : "3",
       	"name" : "test-api-host",
       	"ip": "172.16.0.152",
       	"subnet_id" : "2",
       	"mac" : "a2:a2:a2:a2:a2:a2",
		"managed" : "1",
		"primary" : "1",
		"provision" : "1",
		"type": "Nic::Managed",
		"virtual" : "0",
		"compute_attributes" : {
			"cni_provider":"multus",
			"network": "default"
		}
	}
    }
  }
}

Comment 4 Vatsal Parekh 2019-04-24 10:29:50 UTC
Production log
```
2019-04-24T10:29:19 [I|app|e70eb7ae] Started POST "/api/hosts" for 10.65.223.213 at 2019-04-24 10:29:19 +0000
2019-04-24T10:29:19 [I|app|e70eb7ae] Processing by Api::V2::HostsController#create as JSON
2019-04-24T10:29:19 [I|app|e70eb7ae]   Parameters: {"location_id"=>"1", "organization_id"=>"2", "host"=>{"name"=>"test-api-host", "location_id"=>1, "organization_id"=>1, "compute_resource_id"=>1, "provision_method"=>"build", "compute_attributes"=>{"cores"=>"1", "memory"=>1024, "volumes_attributes"=>{"0"=>{"storage_class"=>"gluster-default-volume", "capacity"=>"1"}}}, "operatingsystem_id"=>1, "architecture_id"=>1, "interfaces_attributes"=>{"0"=>{"domain_id"=>"3", "name"=>"test-api-host", "ip"=>"172.16.0.152", "subnet_id"=>"2", "mac"=>"a2:a2:a2:a2:a2:a2", "managed"=>"1", "primary"=>"1", "provision"=>"1", "type"=>"Nic::Managed", "virtual"=>"0", "compute_attributes"=>{"cni_provider"=>"multus", "network"=>"default"}}}}, "apiv"=>"v2"}
2019-04-24T10:29:19 [I|app|e70eb7ae] Current user set to admin (admin)
2019-04-24T10:29:20 [W|app|e70eb7ae] Not queueing Nic::Managed: ["Compute resource is not defined for host's organization"]
2019-04-24T10:29:20 [W|app|e70eb7ae] Not queueing Nic::Managed: ["Compute resource is not defined for host's organization"]
2019-04-24T10:29:20 [W|app|e70eb7ae] Not queueing Nic::Managed: ["Compute resource is not defined for host's organization"]
2019-04-24T10:29:20 [W|app|e70eb7ae] Not queueing Host::Managed: ["Interfaces.compute resource is not defined for host's organization"]
2019-04-24T10:29:20 [W|app|e70eb7ae] Not queueing Host::Managed: ["Interfaces.compute resource is not defined for host's organization"]
2019-04-24T10:29:20 [W|app|e70eb7ae] Not queueing Host::Managed: ["Interfaces.compute resource is not defined for host's organization"]
2019-04-24T10:29:20 [E|app|e70eb7ae] Unprocessable entity Host::Managed (id: new):
  Interfaces.compute resource is not defined for host's organization

2019-04-24T10:29:20 [I|app|e70eb7ae]   Rendering api/v2/errors/unprocessable_entity.json.rabl within api/v2/layouts/error_layout
2019-04-24T10:29:20 [I|app|e70eb7ae]   Rendered api/v2/errors/unprocessable_entity.json.rabl within api/v2/layouts/error_layout (2.0ms)
2019-04-24T10:29:20 [I|app|e70eb7ae] Completed 422 Unprocessable Entity in 682ms (Views: 4.5ms | ActiveRecord: 40.3ms)
```

Comment 5 Shira Maximov 2019-04-28 14:15:11 UTC
Vatsal, 
Please see that you are using the organization_id twice, with id 1 and with 2. 
please choose the one that relevant and send the request again.


Note You need to log in before you can comment on or make changes to this bug.