Update stack return empty values value for Template Resource after Check Stack

Solution In Progress - Updated -

Environment

  • Red Hat Openstack Platform 5
  • Red Hat Openstack Platform 6
  • Red Hat Openstack Platform 7
  • Red Hat Openstack Platform 8

Issue

What problem/issue/behavior are you having trouble with? What do you expect to see?

Bad behavior can be seen when updating a stack ( Heat Stack Check->Update ).All the Outputs params for Resource Type could be lost depending on the scenario of our stacks.

This could be an exmple setup: There is a Resource B that get some param from Resource A. Performing a Check Stack and then Update Stack – Resource B need to get the param from Resource A and now this param appears as null/empty, then the stack update will use empty value and will fail .

The following traces could be seen on Server B:

 log_http_response /usr/lib/python2.7/site-packages/glanceclient/common/http.py:136
2016-01-14 20:06:16.255 17722 INFO heat.engine.resource [-] UPDATE: Server "server" [b324dac9-6abd-4795-9f4a-b53de09943f1] Stack "test8-resource_B-sa6xqkai65pq" [1b81f309-d8ac-4acb-9583-f9b6dbfe64e3]
2016-01-14 20:06:16.255 17722 TRACE heat.engine.resource Traceback (most recent call last):
2016-01-14 20:06:16.255 17722 TRACE heat.engine.resource File "/usr/lib/python2.7/site-packages/heat/engine/resource.py", line 543, in _action_recorder
2016-01-14 20:06:16.255 17722 TRACE heat.engine.resource yield
2016-01-14 20:06:16.255 17722 TRACE heat.engine.resource File "/usr/lib/python2.7/site-packages/heat/engine/resource.py", line 811, in update
2016-01-14 20:06:16.255 17722 TRACE heat.engine.resource args=[after, tmpl_diff, prop_diff])
2016-01-14 20:06:16.255 17722 TRACE heat.engine.resource File "/usr/lib/python2.7/site-packages/heat/engine/scheduler.py", line 296, in wrapper
2016-01-14 20:06:16.255 17722 TRACE heat.engine.resource step = next(subtask)
2016-01-14 20:06:16.255 17722 TRACE heat.engine.resource File "/usr/lib/python2.7/site-packages/heat/engine/resource.py", line 584, in action_handler_task
2016-01-14 20:06:16.255 17722 TRACE heat.engine.resource handler_data = handler(*args)
2016-01-14 20:06:16.255 17722 TRACE heat.engine.resource File "/usr/lib/python2.7/site-packages/heat/engine/resources/openstack/nova/server.py", line 1115, in handle_update
2016-01-14 20:06:16.255 17722 TRACE heat.engine.resource self.client_plugin().rename(server, prop_diff[self.NAME])
2016-01-14 20:06:16.255 17722 TRACE heat.engine.resource File "/usr/lib/python2.7/site-packages/heat/engine/clients/os/nova.py", line 348, in rename
2016-01-14 20:06:16.255 17722 TRACE heat.engine.resource server.update(name)
2016-01-14 20:06:16.255 17722 TRACE heat.engine.resource File "/usr/lib/python2.7/site-packages/novaclient/v2/servers.py", line 55, in update
2016-01-14 20:06:16.255 17722 TRACE heat.engine.resource self.manager.update(self, name=name)
2016-01-14 20:06:16.255 17722 TRACE heat.engine.resource File "/usr/lib/python2.7/site-packages/novaclient/v2/servers.py", line 918, in update
2016-01-14 20:06:16.255 17722 TRACE heat.engine.resource return self._update("/servers/%s" % base.getid(server), body, "server")
2016-01-14 20:06:16.255 17722 TRACE heat.engine.resource File "/usr/lib/python2.7/site-packages/novaclient/base.py", line 174, in _update
2016-01-14 20:06:16.255 17722 TRACE heat.engine.resource _resp, body = self.api.client.put(url, body=body)
2016-01-14 20:06:16.255 17722 TRACE heat.engine.resource File "/usr/lib/python2.7/site-packages/novaclient/client.py", line 456, in put
2016-01-14 20:06:16.255 17722 TRACE heat.engine.resource return self._cs_request(url, 'PUT', **kwargs)
2016-01-14 20:06:16.255 17722 TRACE heat.engine.resource File "/usr/lib/python2.7/site-packages/novaclient/client.py", line 428, in _cs_request
2016-01-14 20:06:16.255 17722 TRACE heat.engine.resource resp, body = self._time_request(url, method, **kwargs)
2016-01-14 20:06:16.255 17722 TRACE heat.engine.resource File "/usr/lib/python2.7/site-packages/novaclient/client.py", line 397, in _time_request
2016-01-14 20:06:16.255 17722 TRACE heat.engine.resource resp, body = self.request(url, method, **kwargs)
2016-01-14 20:06:16.255 17722 TRACE heat.engine.resource File "/usr/lib/python2.7/site-packages/novaclient/client.py", line 391, in request
2016-01-14 20:06:16.255 17722 TRACE heat.engine.resource raise exceptions.from_response(resp, body, url, method)
2016-01-14 20:06:16.255 17722 TRACE heat.engine.resource BadRequest: Server name has a minimum character requirement of 1. (HTTP 400) (Request-ID: req-3950e5c0-c04f-4292-b93f-b3b9d24a5a36)
2016-01-14 20:06:16.255 17722 TRACE heat.engine.resource
2016-01-14 20:06:16.261 17722 DEBUG heat.engine.scheduler [-] Task update_task from Stack "test8" [1e3411a3-7e6d-4ba9-99e2-055faa394b82] running step /usr/lib/python2.7/site-packages/heat/engine/scheduler.py:220
2016-01-14 20:06:16.262 17722 DEBUG heat.engine.scheduler [-] Task Stack "test8" [1e3411a3-7e6d-4ba9-99e2-055faa394b82] Update running step /usr/lib/python2.7/site-packages/heat/engine/scheduler.py:220

Example templates:



[1] test.yaml heat_template_version: 2013-05-23 description: parameters: public_net_id: type: string description: ID of public network constraints: - custom_constraint: neutron.network description: Must be a valid network ID flavor: type: string description: Flavor to use constraints: - custom_constraint: nova.flavor description: Must be a valid flavor name image: type: string description: Name of image to use constraints: - custom_constraint: glance.image description: Must be a valid image name resources: server: type: OS::Nova::Server properties: networks: - port: get_resource: server_port name: server_A image: { get_param: image } flavor: { get_param: flavor } server_port: type: OS::Neutron::Port properties: network_id: { get_param: public_net_id } outputs: ip_A: description: IP address A server value: { get_attr: [ server, first_address ] } image_A: value: { get_param: image } [2] env.yaml parameters: flavor: m1.demo image: cirros public_net_id: b54b1eb9-8076-4b3a-92d3-1d5725b03fad

Resolution

Please apply the following erratas:

  • https://rhn.redhat.com/errata/RHSA-2016-0266.html
  • https://rhn.redhat.com/errata/RHEA-2016-0603.html

Root Cause

The bug occurred because when executing SNAPSHOT or CHECK actions, Heat code outputed None instead of the attribute itself.

Here is the description in community bug (https://review.openstack.org/#/c/233485/):

   To get attribute instead of return None if resource
is in SNAPSHOT or CHECK action.

This patch allow to get_attr for hot template version
'2013-05-23' also.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments