Bug 1469542 - heat api fails to list resources due to wrong value of needed_by in undercloud
Summary: heat api fails to list resources due to wrong value of needed_by in undercloud
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat OpenStack
Classification: Red Hat
Component: openstack-heat
Version: 11.0 (Ocata)
Hardware: All
OS: Linux
medium
medium
Target Milestone: z3
: 11.0 (Ocata)
Assignee: Zane Bitter
QA Contact: Ronnie Rasouli
URL:
Whiteboard:
Depends On:
Blocks: 1477891
TreeView+ depends on / blocked
 
Reported: 2017-07-11 13:17 UTC by Jaison Raju
Modified: 2020-12-14 09:05 UTC (History)
12 users (show)

Fixed In Version: openstack-heat-8.0.3-1.el7ost
Doc Type: Bug Fix
Doc Text:
If a stack was created using a version of Heat from RHEL-OSP 7 or earlier, listing resources for the stack would fail beginning with the Heat version from OSP 10, with an error calculating the 'required_by' data. In addition, even for stacks created with later versions of Heat the 'required_by' field was not populated, unless the convergence_engine option was enabled (which is the default starting with OSP 10) at the time the stack was created. Heat now correctly populates the 'required_by' field without error.
Clone Of:
: 1477891 (view as bug list)
Environment:
Last Closed: 2017-10-31 17:42:57 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Launchpad 1703703 0 None None None 2017-07-12 16:06:56 UTC
OpenStack gerrit 483571 0 None MERGED Don't load new copies of current resources 2020-08-21 02:03:01 UTC
Red Hat Product Errata RHBA-2017:3099 0 normal SHIPPED_LIVE openstack-heat bug fix advisory 2017-10-31 21:35:47 UTC

Description Jaison Raju 2017-07-11 13:17:33 UTC
Description of problem:
heat resource-list fails with error :
heatclient.exc.HTTPBadRequest: ERROR: The server could not comply with the request since it is either malformed or otherwise incorrect.

The heat-api logs the error :
-------------------------------------------------------------------------------
2017-05-09 14:58:12.711 5591 ERROR heat.common.wsgi [req-44df7a52-381a-46e3-95ab-6eed0641e2ca 381092704d7148a4afbdbb626f73ce99 1ec8f1ff4c114b1b93f0015a77b52865 - default default] Exception handling resource: arg
ument of type 'NoneType' is not iterable
Traceback (most recent call last):

  File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/server.py", line 133, in _process_incoming
    res = self.dispatcher.dispatch(message)

  File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/dispatcher.py", line 150, in dispatch
    return self._do_dispatch(endpoint, method, ctxt, args)

  File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/dispatcher.py", line 121, in _do_dispatch
    result = func(ctxt, **new_args)

  File "/usr/lib/python2.7/site-packages/osprofiler/profiler.py", line 154, in wrapper
    return f(*args, **kwargs)

  File "/usr/lib/python2.7/site-packages/heat/common/context.py", line 424, in wrapped
    return func(self, ctx, *args, **kwargs)

  File "/usr/lib/python2.7/site-packages/heat/engine/service.py", line 1945, in list_stack_resources
    for resource in rsrcs]

  File "/usr/lib/python2.7/site-packages/heat/engine/api.py", line 345, in format_stack_resource
    rpc_api.RES_REQUIRED_BY: resource.required_by(),

  File "/usr/lib/python2.7/site-packages/heat/engine/resource.py", line 659, in required_by
    if r.id in self.needed_by]

TypeError: argument of type 'NoneType' is not iterable
-------------------------------------------------------------------------------

Version-Release number of selected component (if applicable):
openstack-heat-api.noarch        1:7.0.2-4.el7ost    @rhel-7-server-openstack-10-rpms
openstack-heat-api-cfn.noarch    1:7.0.2-4.el7ost    @rhel-7-server-openstack-10-rpms
openstack-heat-api-cloudwatch.noarch
openstack-heat-common.noarch     1:7.0.2-4.el7ost    @rhel-7-server-openstack-10-rpms
openstack-heat-engine.noarch     1:7.0.2-4.el7ost    @rhel-7-server-openstack-10-rpms

How reproducible:
Always .

Steps to Reproduce:
1. Modify heat.resource table :
MariaDB [heat]> update resource set needed_by = 'null' where  uuid='0b1bab2d-ba42-4f45-b547-7642a737760f';
2. Run heat resource-list
Review cmd error output & api error .
3. Run following to fix it back:
MariaDB [heat]> update resource set needed_by = '[]' where  uuid='0b1bab2d-ba42-4f45-b547-7642a737760f';

Actual results:
DB has wrong entry of needed_by & resource list fails with above error .

Expected results:
DB entries do not have 'null' .

Additional info:

On further analysis it was identified that a large number of entries in heat.resource table has needed_by & requires as string value 'null' .
Where as default environment these two values are always set as '[]' .

Comment 5 Zane Bitter 2017-07-12 16:06:56 UTC
Having null in the database is not a problem per se. The problem is that we're hitting a code path that we're not intending to hit unless the value has been updated to [].

That said, updating the database to contain [] instead of null would work, and wouldn't have any negative consequences.

Comment 8 errata-xmlrpc 2017-10-31 17:42:57 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2017:3099


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