Bug 1561962 - Unable to create Cloud Network "<network_name>": undefined method `[]' for nil:NilClass
Summary: Unable to create Cloud Network "<network_name>": undefined method `[]' for ni...
Keywords:
Status: CLOSED DUPLICATE of bug 1562065
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Providers
Version: 5.9.0
Hardware: Unspecified
OS: Unspecified
high
medium
Target Milestone: GA
: cfme-future
Assignee: Marek Aufart
QA Contact: Radim Hrazdil
URL:
Whiteboard:
Depends On: 1562065
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-03-29 09:19 UTC by Radim Hrazdil
Modified: 2018-05-23 14:55 UTC (History)
10 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-05-23 14:55:30 UTC
Category: ---
Cloudforms Team: RHEVM
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
network_error_message (37.17 KB, image/png)
2018-04-27 08:01 UTC, Radim Hrazdil
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1562065 0 high CLOSED Unable to create Cloud Network due to undefined method 2021-02-22 00:41:40 UTC

Internal Links: 1562065

Description Radim Hrazdil 2018-03-29 09:19:48 UTC
Description of problem:
When trying to add a network to Ovirt virtual network manager with selected 'Provider network type' other than None, then adding the network fails with error message:
"Unable to create Cloud Network "<network_name>": undefined method `[]' for nil:NilClass"

I'm setting How reproducible to 90%, because one attempt actually succeeded, not sure why.


Version-Release number of selected component (if applicable):
CFME 5.9.2.0.20180320210136_355c506 
RHV Version 4.2.2.5-0.1.el7

How reproducible:
90%

Steps to Reproduce:
1. Have ovirt 4.2 in CFME with OVN provider installed
2. Go to Networks -> Networks
3. add a new network using the ovirt network manager with any Provider Network Type except None

Actual results:
Operation fails with the above error message

Expected results:
New network should be added

Additional info:
The error message could be improved to be more descriptive about what happened and why. It is possible, that not all network types are supported in OVirt OVN, in that case, only supported types should be listed.


evm.log:

[----] I, [2018-03-29T05:05:13.343247 #2752:11ff134]  INFO -- : MIQ(MiqServer#populate_queue_messages) Fetched 1 miq_queue rows for queue_name=generic, wcount=4, priority=200
[----] I, [2018-03-29T05:05:13.688056 #3018:11ff134]  INFO -- : MIQ(MiqPriorityWorker::Runner#get_message_via_drb) Message id: [9334], MiqWorker id: [3], Zone: [default], Role: [ems_operations], Server: [], Ident: [generic], Target id: [], Instance id: [12], Task id: [], Command: [ManageIQ::Providers::Redhat::NetworkManager.create_cloud_network], Timeout: [600], Priority: [20], State: [dequeue], Deliver On: [], Data: [], Args: [{:name=>"my_new_network", :admin_state_up=>true, :shared=>false, :external_facing=>false, :provider_network_type=>"local", :provider_physical_network=>"10.10.10.0/16", :cloud_tenant=>#<ManageIQ::Providers::Openstack::CloudManager::CloudTenant id: 6, name: "tenant", description: "tenant", enabled: true, ems_ref: "00000000000000000000000000000001", ems_id: 11, created_at: "2018-03-28 10:21:53", updated_at: "2018-03-28 10:21:53", type: "ManageIQ::Providers::Openstack::CloudManager::Clou...", parent_id: nil>, :task_id=>87}], Dequeued in: [4.526403978] seconds
[----] I, [2018-03-29T05:05:13.688255 #3018:11ff134]  INFO -- : MIQ(MiqQueue#deliver) Message id: [9334], Delivering...
[----] I, [2018-03-29T05:05:13.694224 #3018:11ff134]  INFO -- : MIQ(ManageIQ::Providers::Redhat::NetworkManager#with_provider_connection) Connecting through ManageIQ::Providers::Redhat::NetworkManager: [rhv_cfme_integration Network Manager]
[----] E, [2018-03-29T05:05:13.866619 #3018:11ff134] ERROR -- : MIQ(ManageIQ::Providers::Redhat::NetworkManager::CloudNetwork.raw_create_cloud_network) network=[my_new_network], error: Expected([201]) <=> Actual(400 Bad Request)
excon.error.response
  :body          => "{\n  \"error\": {\n    \"message\": \"provider:network_type [local] is not supported\",\n    \"code\": 400,\n    \"title\": \"Bad Request\"\n  }\n}\n"
  :cookies       => [
  ]
  :headers       => {
    "Connection"   => "close"
    "Content-Type" => "application/json"
    "Date"         => "Thu, 29 Mar 2018 09:05:13 GMT"
    "Server"       => "BaseHTTP/0.3 Python/2.7.5"
  }
  :host          => "<engine_fqdn>"
  :local_address => "<CFME_IP>"
  :local_port    => <local_port>
  :path          => "/v2.0/networks"
  :port          => 9696
  :reason_phrase => "Bad Request"
  :remote_ip     => "<engine_IP>"
  :status        => 400
  :status_line   => "HTTP/1.0 400 Bad Request\r\n"

[----] E, [2018-03-29T05:05:13.868626 #3018:11ff134] ERROR -- : MIQ(MiqQueue#deliver) Message id: [9334], Error: [undefined method `[]' for nil:NilClass]
[----] E, [2018-03-29T05:05:13.868883 #3018:11ff134] ERROR -- : [NoMethodError]: undefined method `[]' for nil:NilClass  Method:[block in method_missing]
[----] E, [2018-03-29T05:05:13.869125 #3018:11ff134] ERROR -- : /opt/rh/cfme-gemset/bundler/gems/cfme-providers-openstack-3ffa6670e3c4/app/models/manageiq/providers/openstack/helper_methods.rb:24:in `parse_error_message_from_neutron_response'
/opt/rh/cfme-gemset/bundler/gems/cfme-providers-openstack-3ffa6670e3c4/app/models/manageiq/providers/openstack/network_manager/cloud_network.rb:53:in `rescue in raw_create_cloud_network'
/opt/rh/cfme-gemset/bundler/gems/cfme-providers-openstack-3ffa6670e3c4/app/models/manageiq/providers/openstack/network_manager/cloud_network.rb:43:in `raw_create_cloud_network'
/opt/rh/cfme-gemset/bundler/gems/cfme-providers-ovirt-549dfa05bc6e/app/models/manageiq/providers/redhat/network_manager.rb:84:in `create_cloud_network'
/var/www/miq/vmdb/app/models/miq_queue.rb:449:in `block in dispatch_method'
/opt/rh/rh-ruby23/root/usr/share/ruby/timeout.rb:91:in `block in timeout'
/opt/rh/rh-ruby23/root/usr/share/ruby/timeout.rb:33:in `block in catch'
/opt/rh/rh-ruby23/root/usr/share/ruby/timeout.rb:33:in `catch'
/opt/rh/rh-ruby23/root/usr/share/ruby/timeout.rb:33:in `catch'
/opt/rh/rh-ruby23/root/usr/share/ruby/timeout.rb:106:in `timeout'
/var/www/miq/vmdb/app/models/miq_queue.rb:448:in `dispatch_method'
/var/www/miq/vmdb/app/models/miq_queue.rb:425:in `block in deliver'
/var/www/miq/vmdb/app/models/user.rb:261:in `with_user_group'
/var/www/miq/vmdb/app/models/miq_queue.rb:425:in `deliver'
/var/www/miq/vmdb/app/models/miq_queue_worker_base/runner.rb:104:in `deliver_queue_message'
/var/www/miq/vmdb/app/models/miq_queue_worker_base/runner.rb:134:in `deliver_message'
/var/www/miq/vmdb/app/models/miq_queue_worker_base/runner.rb:152:in `block in do_work'
/var/www/miq/vmdb/app/models/miq_queue_worker_base/runner.rb:146:in `loop'
/var/www/miq/vmdb/app/models/miq_queue_worker_base/runner.rb:146:in `do_work'
/var/www/miq/vmdb/app/models/miq_worker/runner.rb:329:in `block in do_work_loop'
/var/www/miq/vmdb/app/models/miq_worker/runner.rb:326:in `loop'
/var/www/miq/vmdb/app/models/miq_worker/runner.rb:326:in `do_work_loop'
/var/www/miq/vmdb/app/models/miq_worker/runner.rb:153:in `run'
/var/www/miq/vmdb/app/models/miq_worker/runner.rb:127:in `start'
/var/www/miq/vmdb/app/models/miq_worker/runner.rb:22:in `start_worker'
/var/www/miq/vmdb/app/models/miq_worker.rb:375:in `block in start_runner_via_fork'
/opt/rh/cfme-gemset/gems/nakayoshi_fork-0.0.3/lib/nakayoshi_fork.rb:24:in `fork'
/opt/rh/cfme-gemset/gems/nakayoshi_fork-0.0.3/lib/nakayoshi_fork.rb:24:in `fork'
/var/www/miq/vmdb/app/models/miq_worker.rb:373:in `start_runner_via_fork'
/var/www/miq/vmdb/app/models/miq_worker.rb:367:in `start_runner'
/var/www/miq/vmdb/app/models/miq_worker.rb:414:in `start'
/var/www/miq/vmdb/app/models/miq_worker.rb:266:in `start_worker'
/var/www/miq/vmdb/app/models/miq_worker.rb:153:in `block in sync_workers'
/var/www/miq/vmdb/app/models/miq_worker.rb:153:in `times'
/var/www/miq/vmdb/app/models/miq_worker.rb:153:in `sync_workers'
/var/www/miq/vmdb/app/models/miq_server/worker_management/monitor.rb:53:in `block in sync_workers'
/var/www/miq/vmdb/app/models/miq_server/worker_management/monitor.rb:50:in `each'
/var/www/miq/vmdb/app/models/miq_server/worker_management/monitor.rb:50:in `sync_workers'
/var/www/miq/vmdb/app/models/miq_server.rb:146:in `start'
/var/www/miq/vmdb/app/models/miq_server.rb:238:in `start'
/var/www/miq/vmdb/lib/workers/evm_server.rb:27:in `start'
/var/www/miq/vmdb/lib/workers/evm_server.rb:48:in `start'
/var/www/miq/vmdb/lib/workers/bin/evm_server.rb:4:in `<main>'

Comment 3 Radim Hrazdil 2018-04-13 08:47:24 UTC
The same Error message also occurs when adding a Security Group. Adding the info here, as it is most likely the same issue.

[----] E, [2018-04-13T04:38:31.586732 #3026:11ff134] ERROR -- : MIQ(ManageIQ::Providers::Redhat::NetworkManager::SecurityGroup.raw_create_security_group) security_group=[newtestsecuritygroup], error: Expected(201) <=> Actual(405 Method Not Allowed)
excon.error.response
  :body          => "{\n  \"error\": {\n    \"message\": \"Method not allowed: POST\",\n    \"code\": 405,\n    \"title\": \"Method Not Allowed\"\n  }\n}\n"
  :cookies       => [
  ]
  :headers       => {
    "Connection"   => "close"
    "Content-Type" => "application/json"
    "Date"         => "Fri, 13 Apr 2018 08:38:31 GMT"
    "Server"       => "BaseHTTP/0.3 Python/2.7.5"
  }
  :host          => "<ovirt_engine_fqdn>"
  :local_address => "<CFME_IP>"
  :local_port    => 42744
  :path          => "/v2.0/security-groups"
  :port          => 9696
  :reason_phrase => "Method Not Allowed"
  :remote_ip     => "<ovirt_engine_IP>"
  :status        => 405
  :status_line   => "HTTP/1.0 405 Method Not Allowed\r\n"

[----] E, [2018-04-13T04:38:31.589752 #3026:11ff134] ERROR -- : MIQ(MiqQueue#deliver) Message id: [80098], Error: [undefined method `[]' for nil:NilClass]
[----] E, [2018-04-13T04:38:31.590165 #3026:11ff134] ERROR -- : [NoMethodError]: undefined method `[]' for nil:NilClass  Method:[block in method_missing]
[----] E, [2018-04-13T04:38:31.590513 #3026:11ff134] ERROR -- : /opt/rh/cfme-gemset/bundler/gems/cfme-providers-openstack-3ffa6670e3c4/app/models/manageiq/providers/openstack/helper_methods.rb:24:in `parse_error_message_from_neutron_response'
...

Comment 4 Alona Kaplan 2018-04-22 07:30:02 UTC
Adding a cloud network with network type 'local' is not supported by the ovirt-provider-ovn (you can see the error in the ovn provider log).
Marcin, can you please add a list of the supported network types.

Adding SecurityGroup is currently not supported by the ovn provider (same - you can see the error in the ovn provider log).

Regarding the unreadable error messages - https://github.com/ManageIQ/manageiq-providers-openstack/pull/263/files should have fixed it.

Comment 5 Marcin Mirecki 2018-04-25 13:35:36 UTC
We support "flat" and "vlan"
With flat, provider:physical_network must also be give
With valn, we must additionally have provider:segmentation_id
(as in: https://developer.openstack.org/api-ref/network/v2/#networks)

Comment 6 Alona Kaplan 2018-04-26 07:40:04 UTC
Hi Radim,

If now with https://github.com/ManageIQ/manageiq-providers-openstack/pull/263 the error looks better. Can you please consider closing the bug?

Comment 7 Radim Hrazdil 2018-04-27 08:01:02 UTC
Created attachment 1427546 [details]
network_error_message

Hello Alona,

I just checked the new error message (screenshot attached), the content of the error message is correct, but I believe, the error message still could be improved.

This is ok to be logged, in UI I would imagine something like:
Unable to create Cloud Network "test": nework_type [vxlan] is not supported.

Comment 8 Alona Kaplan 2018-05-16 08:07:21 UTC
Hi Radim and Ilanit,

That's the format of the error returned from the provider/neutron.
Maybe it should be parsed.

Anyway, IMO it is not a rhev provider bug.

Comment 9 Radim Hrazdil 2018-05-23 14:55:30 UTC
Hello Alona,

I agree. Closing this as a duplicate of BZ1562065 as the original error is fixed by [1]. 

[1] https://github.com/ManageIQ/manageiq-providers-openstack/pull/263

*** This bug has been marked as a duplicate of bug 1562065 ***


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