Bug 1446822 - Topology view crashes with container linking in place
Summary: Topology view crashes with container linking in place
Keywords:
Status: CLOSED EOL
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Providers
Version: unspecified
Hardware: Unspecified
OS: Unspecified
urgent
urgent
Target Milestone: GA
: 5.9.0
Assignee: Jirka Kremser
QA Contact: Matt Mahoney
URL:
Whiteboard: :middleware
Depends On:
Blocks: 1447432
TreeView+ depends on / blocked
 
Reported: 2017-04-29 08:12 UTC by Heiko W. Rupp
Modified: 2018-03-30 17:22 UTC (History)
12 users (show)

Fixed In Version: 5.9.0.1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1447432 (view as bug list)
Environment:
Last Closed: 2018-03-06 15:36:29 UTC
Category: ---
Cloudforms Team: Middleware
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Screenshot of the failure (61.04 KB, image/png)
2017-04-29 08:13 UTC, Heiko W. Rupp
no flags Details

Description Heiko W. Rupp 2017-04-29 08:12:13 UTC
Topology view fails when x-linking between MW servers and containers is in place.
See http://pastebin.test.redhat.com/479922 for a trace and the attachment for a UI snapshot

Comment 1 Heiko W. Rupp 2017-04-29 08:13:03 UTC
Created attachment 1275141 [details]
Screenshot of the failure

Comment 2 Alissa 2017-04-30 13:02:38 UTC
the important part for whoever can't access pastebin:
[----] I, [2017-04-28T19:05:32.731564 #2206:3fe951523850]  INFO -- : Started GET "/middleware_topology/data" for 127.0.0.1 at 2017-04-28 19:05:32 +0000
[----] I, [2017-04-28T19:05:32.732644 #2206:3fe951523850]  INFO -- : Processing by MiddlewareTopologyController#data as HTML
[----] F, [2017-04-28T19:05:32.796056 #2206:3fe951523850] FATAL -- : Error caught: [NoMethodError] undefined method `host' for #<ManageIQ::Providers::Kubernetes::ContainerManager::Container:0x007fd2ad585098>
/opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/activemodel-5.0.2/lib/active_model/attribute_methods.rb:433:in `method_missing'
/opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/bundler/gems/manageiq-ui-classic-70ba36ca1c67/app/services/topology_service.rb:69:in `block in map_to_graph'
/opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/bundler/gems/manageiq-ui-classic-70ba36ca1c67/app/services/topology_service.rb:67:in `each_pair'
/opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/bundler/gems/manageiq-ui-classic-70ba36ca1c67/app/services/topology_service.rb:67:in `map_to_graph'
/opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/bundler/gems/manageiq-ui-classic-70ba36ca1c67/app/services/topology_service.rb:36:in `build_topology'
/opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/bundler/gems/manageiq-ui-classic-70ba36ca1c67/app/services/middleware_topology_service.rb:21:in `build_topology'
/opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/bundler/gems/manageiq-ui-classic-70ba36ca1c67/app/controllers/topology_controller.rb:51:in `generate_topology'
/opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/bundler/gems/manageiq-ui-classic-70ba36ca1c67/app/controllers/topology_controller.rb:37:in `data'

Comment 3 Alissa 2017-04-30 19:46:05 UTC
The issue happens because so far cross linking was to a VM, which in turn was linked to a Host.
Due to that, the topology relationship in containers and in middleware topologies assumed the following was always correct:

https://github.com/ManageIQ/manageiq-ui-classic/blob/master/app/services/middleware_topology_service.rb#L14

However since cross linking to container was added as well, there is no "host" linked to a container, hence it fails in cases where the cross linking is to container and not to VM because it tries to call container.host

The data hierarchy is built here:
https://github.com/ManageIQ/manageiq-ui-classic/blob/master/app/services/topology_service.rb#L69

The solution should be:
1. as first measure, check if a method exists before calling it (something like if entity.respond_to?(head.to_s.underscore.downcase)) , so if not able to call "host" on a container object, it won't crash. 
2. in addition, the "bigger picture" solution for next version (I'll open a separate issue) - hierarchy for topology (the  @included_relations variable present on every provider's topology specific service) should no longer assume there is a single type of "lives_on", and it should support multiple types that are not always linked in the same hierarchy (lives_on could be of type container, VM, some other type, etc)

Jiri, please work on it, and seek review&assistance if needed from David Halasz, he rewrote recently a lot of parts in topology, and in particular the parts related to this bug.

Comment 4 John Mazzitelli 2017-05-01 15:08:34 UTC
I wrote this up - I think its related: https://issues.jboss.org/browse/HAWKULAR-1213

Comment 5 Jirka Kremser 2017-05-02 13:59:08 UTC
The hot-fix that basically doesn't allow to call a method that is not defined is here: https://github.com/ManageIQ/manageiq-ui-classic/pull/1221

However, this only prevents the error pop-up and allows the topology graph to render, but doesn't actually show the linked container in the graph.

Comment 6 Heiko W. Rupp 2017-05-02 16:01:12 UTC
https://github.com/ManageIQ/manageiq-ui-classic/pull/1223 is the real fix on top of #1221

Comment 8 Alissa 2017-05-03 08:49:31 UTC
(In reply to John Mazzitelli from comment #4)
> I wrote this up - I think its related:
> https://issues.jboss.org/browse/HAWKULAR-1213

John, it is not related to the issue reported in this bug.


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