Bug 1469542 - heat api fails to list resources due to wrong value of needed_by in undercloud
heat api fails to list resources due to wrong value of needed_by in undercloud
Product: Red Hat OpenStack
Classification: Red Hat
Component: openstack-heat (Show other bugs)
11.0 (Ocata)
All Linux
medium Severity medium
: z3
: 11.0 (Ocata)
Assigned To: Zane Bitter
Ronnie Rasouli
: TestOnly, Triaged, ZStream
Depends On:
Blocks: 1477891
  Show dependency treegraph
Reported: 2017-07-11 09:17 EDT by Jaison Raju
Modified: 2017-10-31 13:42 EDT (History)
12 users (show)

See Also:
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.
Story Points: ---
Clone Of:
: 1477891 (view as bug list)
Last Closed: 2017-10-31 13:42:57 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

External Trackers
Tracker ID Priority Status Summary Last Updated
Launchpad 1703703 None None None 2017-07-12 12:06 EDT
OpenStack gerrit 483571 None None None 2017-09-07 08:45 EDT

  None (edit)
Description Jaison Raju 2017-07-11 09:17:33 EDT
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-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 12:06:56 EDT
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 13:42:57 EDT
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.


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