Bug 1424578 - Heat doesn't inject personality files on rebuild
Summary: Heat doesn't inject personality files on rebuild
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat OpenStack
Classification: Red Hat
Component: openstack-heat
Version: 10.0 (Newton)
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: async
: 10.0 (Newton)
Assignee: Zane Bitter
QA Contact: Amit Ugol
URL:
Whiteboard:
Depends On: 1404464 1421766
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-02-17 17:37 UTC by Zane Bitter
Modified: 2017-05-17 12:21 UTC (History)
11 users (show)

Fixed In Version: openstack-heat-7.0.2-1.el7ost
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1404464
Environment:
Last Closed: 2017-05-17 12:21:19 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Launchpad 1650470 0 None None None 2017-02-17 17:37:05 UTC
OpenStack gerrit 414116 0 None None None 2017-02-17 17:37:05 UTC
Red Hat Product Errata RHSA-2017:1243 0 normal SHIPPED_LIVE Moderate: openstack-heat security, bug fix, and enhancement update 2017-05-17 16:18:42 UTC

Description Zane Bitter 2017-02-17 17:37:05 UTC
+++ This bug was initially created as a clone of Bug #1404464 +++

Description of problem:

When we change image and do heat stack update it doesn't re-inject the personality files.

By default OS::Nova::Server image_update_policy is doing REBUILD of an instance.

http://docs.openstack.org/developer/heat/template_guide/openstack.html#OS::Nova::Server-prop-image_update_policy

We can see that in nova when we call rebuild we preserve all the VMs metadata and personality files.

Also it's bit confusing since in Heat Resource OS::Nova::Server it shows that the personality property is update_allowed: false and from the developer_guide [1] we can see that this means that update is accomplished only by delete and re-create.

# heat resource-type-show OS::Nova::Server  | grep personality -A6
    "personality": {
      "description": "A map of files to create/overwrite on the server upon boot. Keys are file names and values are the file contents.", 
      "default": {}, 
      "required": false, 
      "update_allowed": false, 
      "type": "map", 
      "immutable": false

When we switched the image_update_policy to REPLACE it worked, that could be explained by above.

However if the personality files are preserved with nova, shouldn't it also be same for Heat?

[1] http://docs.openstack.org/developer/heat/developing_guides/pluginguide.html

Version-Release number of selected component (if applicable):

heat 2015.1.2

How reproducible:

Steps to Reproduce:
1. Create stack
2. Change image to another image.
3. Update stack with new image

Actual results:

Personality files not injected

Expected results:

Inject personality files.

Additional info:

Possible patch submitted:

1, /usr/lib/python2.7/site-packages/heat/engine/resources/openstack/nova/server.py

def _update_image(self, prop_diff):
    image_update_policy = (prop_diff.get(self.IMAGE_UPDATE_POLICY) or self.properties[self.IMAGE_UPDATE_POLICY])
    image = prop_diff[self.IMAGE]
    image_id = self.client_plugin('glance').get_image_id(image)
    preserve_ephemeral = (image_update_policy == 'REBUILD_PRESERVE_EPHEMERAL')
    password = (prop_diff.get(self.ADMIN_PASS) or
    self.properties[self.ADMIN_PASS])
    personality_files = self.properties[self.PERSONALITY]
    kwargs = {'password': password,'preserve_ephemeral': preserve_ephemeral, 'files_to_inject':personality_files}
    prg = progress.ServerUpdateProgress(self.resource_id,'rebuild',handler_extra={'args': (image_id,), 'kwargs': kwargs})
    return prg

2,
/usr/lib/python2.7/site-packages/heat/engine/clients/os/nova.py

def rebuild(self, server_id, image_id, password=None,preserve_ephemeral=False, files_to_inject=None):
    """Rebuild the server and call check_rebuild to verify."""
    server = self.fetch_server(server_id)
    if server:
        server.rebuild(image_id, password=password,preserve_ephemeral=preserve_ephemeral,files=files_to_inject)
        return True
    else:
        return False

Comment 1 Zane Bitter 2017-02-17 17:46:04 UTC
Already picked up in 7.0.2 rebase.

Comment 2 Jon Schlueter 2017-03-16 12:22:17 UTC
According to our records, this should be resolved by openstack-heat-7.0.2-1.el7ost.  This build is available now.

Comment 5 errata-xmlrpc 2017-05-17 12:21:19 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/RHSA-2017:1243


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