Bug 1424587 - 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: 8.0 (Liberty)
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: 8.0 (Liberty)
Assignee: Zane Bitter
QA Contact: Amit Ugol
URL:
Whiteboard:
Depends On: 1404464
Blocks: 1424586
TreeView+ depends on / blocked
 
Reported: 2017-02-17 17:41 UTC by Zane Bitter
Modified: 2022-07-09 09:04 UTC (History)
11 users (show)

Fixed In Version: openstack-heat-5.0.3-2.el7ost
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1404464
Environment:
Last Closed: 2017-06-14 15:26:22 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Launchpad 1650470 0 None None None 2017-02-17 17:41:21 UTC
OpenStack gerrit 414127 0 'None' MERGED Use metadata and personality with server rebuild 2020-10-06 17:13:19 UTC
Red Hat Issue Tracker OSP-16856 0 None None None 2022-07-09 09:04:30 UTC
Red Hat Product Errata RHSA-2017:1456 0 normal SHIPPED_LIVE Low: openstack-heat security and bug fix update 2017-06-14 19:18:02 UTC

Description Zane Bitter 2017-02-17 17:41:21 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 5 errata-xmlrpc 2017-06-14 15:26:22 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:1456


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