Override OS::Nova::Server for user_data updates

This change installs a plugin to /usr/lib/heat.
This plugin replaces the OS::Nova::Server type which is a subclass that
will not replace heat servers on stack-update when the user_data
property is changed.

heat-engine needs to be restarted to register the new plugin, so there
needs to be some mechanism to ensure this during an undercloud upgrade.
It might be possible to rely on puppet doing a service restart when
"openstack undercloud install" is run again during the upgrade. Testing
will reveal whether an explicity restart openstack-heat-engine is
needed.

Any undercloud heat can be tested for whether servers are replaced on
user_data changes by running:

  heat resource-type-show OS::Nova::Server | \
    jq '.properties.user_data.update_allowed'

The result will be 'true' when this change has been successfully
applied.

The intention is that this is backported to stable/liberty to allow
overclouds to be upgraded from kilo to liberty. This issue can be fixed
in heat for Mitaka but that heat change can't be backported to Liberty.

This will work as expected for existing overcloud stacks and their
OS::Nova::Server resouces - no resource will be replaced when
ServerUpdateAllowed becomes active.

Downstream packaging needs to do the same file copying as the setup.cfg
data_files entry, which is to copy the undercloud_heat_plugins directory
to /usr/lib/heat

Change-Id: Ibd2b70527977058d18c12ea71de7f302379c50aa
Closes-Bug: #1539541
This commit is contained in:
Steve Baker 2016-02-23 22:10:43 +00:00
parent d4d80c8a23
commit 2fe97a4bf5
3 changed files with 34 additions and 0 deletions

View File

@ -24,6 +24,7 @@ packages =
data_files =
share/tripleo-common/templates = templates/*
lib/heat/undercloud_heat_plugins = undercloud_heat_plugins/*
[build_sphinx]
source-dir = doc/source

View File

View File

@ -0,0 +1,33 @@
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from heat.engine import properties
from heat.engine.resources.openstack.nova import server
class ServerUpdateAllowed(server.Server):
'''Allows the user_data property to be changed on update without replacement.
'''
properties_schema = dict(server.Server.properties_schema)
properties_schema[server.Server.USER_DATA] = properties.Schema(
properties.Schema.STRING,
'User data script to be executed by cloud-init.',
update_allowed=True,
default=''
)
def resource_mapping():
return {'OS::Nova::Server': ServerUpdateAllowed}