Project

General

Profile

Actions

Bug #26784

closed

Bug 1707349 - [Kubevirt-Foreman] nilClass exception with multiple compute resource of same provider

Added by Moti Asayag over 5 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
-
Difficulty:
easy
Triaged:
No
Fixed in Releases:
Found in Releases:

Description

When trying to create a Host with a compute resource that is of the same provider but different namespace and token, getting this error in the UI
`Failed to create a compute ocp (KubeVirt) instance susie-parker.example.com: undefined method `any?' for nil:NilClass`

production.log
```
2019-05-07T06:55:01 [I|app|37e854dc] Current user set to admin (admin)
2019-05-07T06:55:01 [I|app|37e854dc] Completed 200 OK in 162ms (Views: 0.8ms | ActiveRecord: 24.8ms)
2019-05-07T06:55:01 [I|app|4530c3e3] Started POST "/hosts/current_parameters" for 10.74.10.65 at 2019-05-07 06:55:01 -0400
2019-05-07T06:55:01 [I|app|4530c3e3] Processing by HostsController#current_parameters as /*
2019-05-07T06:55:01 [I|app|4530c3e3] Parameters: {"utf8"=>"✓", "authenticity_token"=>"[FILTERED]", "host"=>{"name"=>"susie-parker", "organization_id"=>"2", "location_id"=>"1", "hostgroup_id"=>"", "compute_resource_id"=>"4", "content_facet_attributes"=>{"lifecycle_environment_id"=>"", "content_view_id"=>"", "content_source_id"=>""}, "environment_id"=>"", "puppet_proxy_id"=>"", "puppet_ca_proxy_id"=>"", "openscap_proxy_id"=>"", "ansible_role_ids"=>[""], "managed"=>"true", "progress_report_id"=>"[FILTERED]", "type"=>"Host::Managed", "interfaces_attributes"=>{"0"=>{"_destroy"=>"0", "type"=>"Nic::Managed", "mac"=>"a2:a2:a2:a2:a2:a2", "identifier"=>"", "name"=>"susie-parker", "domain_id"=>"2", "subnet_id"=>"", "ip"=>"", "ip6"=>"", "managed"=>"1", "primary"=>"1", "provision"=>"1", "execution"=>"1", "virtual"=>"0", "tag"=>"", "attached_to"=>"", "compute_attributes"=>{"cni_provider"=>"multus", "network"=>"testbridge"}}}, "compute_attributes"=>{"cpu_cores"=>"1", "memory"=>"1073741824", "start"=>"1", "image_id"=>"kubevirt/cirros-container-disk-demo"}, "architecture_id"=>"1", "operatingsystem_id"=>"1", "provision_method"=>"image", "build"=>"1", "medium_id"=>"", "ptable_id"=>"", "pxe_loader"=>"PXELinux BIOS", "disk"=>"", "root_pass"=>"[FILTERED]", "is_owned_by"=>"4-Users", "enabled"=>"1", "model_id"=>"", "comment"=>"", "overwrite"=>"false"}, "media_selector"=>"install_media", "fakepassword"=>"[FILTERED]", "host_id"=>"undefined"}
2019-05-07T06:55:01 [I|app|4530c3e3] Current user set to admin (admin)
2019-05-07T06:55:01 [I|app|11052ead] Started POST "/hosts/puppetclass_parameters" for 10.74.10.65 at 2019-05-07 06:55:01 -0400
2019-05-07T06:55:01 [I|app|11052ead] Processing by HostsController#puppetclass_parameters as */

2019-05-07T06:55:01 [I|app|11052ead] Parameters: {"utf8"=>"✓", "authenticity_token"=>"[FILTERED]", "host"=>{"name"=>"susie-parker", "organization_id"=>"2", "location_id"=>"1", "hostgroup_id"=>"", "compute_resource_id"=>"4", "content_facet_attributes"=>{"lifecycle_environment_id"=>"", "content_view_id"=>"", "content_source_id"=>""}, "environment_id"=>"", "puppet_proxy_id"=>"", "puppet_ca_proxy_id"=>"", "openscap_proxy_id"=>"", "ansible_role_ids"=>[""], "managed"=>"true", "progress_report_id"=>"[FILTERED]", "type"=>"Host::Managed", "interfaces_attributes"=>{"0"=>{"_destroy"=>"0", "type"=>"Nic::Managed", "mac"=>"a2:a2:a2:a2:a2:a2", "identifier"=>"", "name"=>"susie-parker", "domain_id"=>"2", "subnet_id"=>"", "ip"=>"", "ip6"=>"", "managed"=>"1", "primary"=>"1", "provision"=>"1", "execution"=>"1", "virtual"=>"0", "tag"=>"", "attached_to"=>"", "compute_attributes"=>{"cni_provider"=>"multus", "network"=>"testbridge"}}}, "compute_attributes"=>{"cpu_cores"=>"1", "memory"=>"1073741824", "start"=>"1", "image_id"=>"kubevirt/cirros-container-disk-demo"}, "architecture_id"=>"1", "operatingsystem_id"=>"1", "provision_method"=>"image", "build"=>"1", "medium_id"=>"", "ptable_id"=>"", "pxe_loader"=>"PXELinux BIOS", "disk"=>"", "root_pass"=>"[FILTERED]", "is_owned_by"=>"4-Users", "enabled"=>"1", "model_id"=>"", "comment"=>"", "overwrite"=>"false"}, "media_selector"=>"install_media", "fakepassword"=>"[FILTERED]", "host_id"=>"undefined"}
2019-05-07T06:55:01 [I|app|11052ead] Current user set to admin (admin)
2019-05-07T06:55:01 [I|app|11052ead] Rendered collection of puppetclasses/_class_parameters.html.erb [0 times] (0.0ms)
2019-05-07T06:55:01 [I|app|11052ead] Rendered puppetclasses/_classes_parameters.html.erb (6.9ms)
2019-05-07T06:55:01 [I|app|11052ead] Completed 200 OK in 47ms (Views: 6.0ms | ActiveRecord: 7.9ms)
2019-05-07T06:55:01 [I|app|4530c3e3] Rendered common_parameters/_inherited_parameters.html.erb (11.5ms)
2019-05-07T06:55:01 [I|app|4530c3e3] Completed 200 OK in 509ms (Views: 23.6ms | ActiveRecord: 50.1ms)
2019-05-07T06:55:03 [I|app|54865b0b] Started POST "/subnets/freeip" for 10.74.10.65 at 2019-05-07 06:55:03 -0400
2019-05-07T06:55:03 [I|app|54865b0b] Processing by SubnetsController#freeip as JSON
2019-05-07T06:55:03 [I|app|54865b0b] Parameters: {"subnet_id"=>"2", "host_mac"=>"a2:a2:a2:a2:a2:a2", "organization_id"=>"2", "location_id"=>"1", "taken_ips"=>["", ""]}
2019-05-07T06:55:03 [I|app|54865b0b] Current user set to admin (admin)
2019-05-07T06:55:03 [I|app|54865b0b] Completed 200 OK in 27ms (Views: 0.4ms | ActiveRecord: 5.2ms)
2019-05-07T06:55:09 [I|app|1d617b8d] Started POST "/hosts" for 10.74.10.65 at 2019-05-07 06:55:09 -0400
2019-05-07T06:55:09 [I|app|1d617b8d] Processing by HostsController#create as */*
2019-05-07T06:55:09 [I|app|1d617b8d] Parameters: {"utf8"=>"✓", "authenticity_token"=>"[FILTERED]", "host"=>{"name"=>"susie-parker", "organization_id"=>"2", "location_id"=>"1", "hostgroup_id"=>"", "compute_resource_id"=>"4", "content_facet_attributes"=>{"lifecycle_environment_id"=>"", "content_view_id"=>"", "content_source_id"=>""}, "environment_id"=>"", "puppet_proxy_id"=>"", "puppet_ca_proxy_id"=>"", "openscap_proxy_id"=>"", "ansible_role_ids"=>[""], "managed"=>"true", "progress_report_id"=>"[FILTERED]", "type"=>"Host::Managed", "interfaces_attributes"=>{"0"=>{"_destroy"=>"0", "type"=>"Nic::Managed", "mac"=>"a2:a2:a2:a2:a2:a2", "identifier"=>"", "name"=>"susie-parker", "domain_id"=>"2", "subnet_id"=>"2", "ip"=>"", "ip6"=>"", "managed"=>"1", "primary"=>"1", "provision"=>"0", "execution"=>"1", "virtual"=>"0", "tag"=>"", "attached_to"=>"", "compute_attributes"=>{"cni_provider"=>"pod", "network"=>"testbridge"}}}, "compute_attributes"=>{"cpu_cores"=>"1", "memory"=>"1073741824", "start"=>"1", "image_id"=>"kubevirt/cirros-container-disk-demo"}, "architecture_id"=>"1", "operatingsystem_id"=>"1", "provision_method"=>"image", "build"=>"1", "medium_id"=>"", "ptable_id"=>"", "pxe_loader"=>"PXELinux BIOS", "disk"=>"", "root_pass"=>"[FILTERED]", "is_owned_by"=>"4-Users", "enabled"=>"1", "model_id"=>"", "comment"=>"", "overwrite"=>"false"}, "media_selector"=>"install_media"}
2019-05-07T06:55:09 [I|app|1d617b8d] Current user set to admin (admin)
2019-05-07T06:55:10 [I|app|1d617b8d] Adding Compute instance for susie-parker.example.com
2019-05-07T06:55:10 [W|app|1d617b8d] Failed to create a compute ocp (KubeVirt) instance susie-parker.example.com: undefined method `any?' for nil:NilClass

NoMethodError: undefined method `any?' for nil:NilClass
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_kubevirt-0.1.2/app/models/foreman_kubevirt/kubevirt.rb:307:in `verify_booting_from_image_is_possible'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_kubevirt-0.1.2/app/models/foreman_kubevirt/kubevirt.rb:314:in `add_volume_for_image_provision'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_kubevirt-0.1.2/app/models/foreman_kubevirt/kubevirt.rb:393:in `create_volumes_for_vm'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_kubevirt-0.1.2/app/models/foreman_kubevirt/kubevirt.rb:138:in `create_vm'
/usr/share/foreman/app/models/concerns/orchestration/compute.rb:91:in `setCompute'
/usr/share/foreman/app/models/concerns/orchestration.rb:222:in `execute'
/usr/share/foreman/app/models/concerns/orchestration.rb:145:in `block in process'
/usr/share/foreman/app/models/concerns/orchestration.rb:137:in `each'
/usr/share/foreman/app/models/concerns/orchestration.rb:137:in `process'

Actions

Also available in: Atom PDF