heat.conf options for transport properties default

This change adds config options so that operators can choose the default
transports for server software_config_transport and deployment
signal_transport. With properly set config values, templates should
have no need for setting these options at all, making templates more
portable across clouds.

The defaults currently are the cfn transports but consideration could be
made in the future to switch to swift.

Downstream deployment tools (puppet etc) would have enough information
to set the best heat.conf values, with something like the following
logic:

- if there is an object-store endpoint, set for *TEMP_URL*
- if there is no cloudformation endpoint, set for *HEAT*
- else set for *CFN*

Change-Id: I5f3d41db35e380486051cee432a7190b3c51fa00
Related-Blueprint: software-config-swift-signal
This commit is contained in:
Steve Baker 2015-03-17 11:52:01 +13:00
parent 7f2521895d
commit 9fa9a101ca
5 changed files with 42 additions and 2 deletions

View File

@ -156,6 +156,38 @@ engine_opts = [
help=_('Enables engine with convergence architecture. All '
'stacks with this option will be created using '
'convergence engine .')),
cfg.StrOpt('default_software_config_transport',
choices=['POLL_SERVER_CFN',
'POLL_SERVER_HEAT',
'POLL_TEMP_URL'],
default='POLL_SERVER_CFN',
help=_('Template default for how the server should receive the '
'metadata required for software configuration. '
'POLL_SERVER_CFN will allow calls to the cfn API action '
'DescribeStackResource authenticated with the provided '
'keypair (requires enabled heat-api-cfn). '
'POLL_SERVER_HEAT will allow calls to the '
'Heat API resource-show using the provided keystone '
'credentials (requires keystone v3 API, and configured '
'stack_user_* config options). '
'POLL_TEMP_URL will create and populate a '
'Swift TempURL with metadata for polling (requires '
'object-store endpoint which supports TempURL).')),
cfg.StrOpt('default_deployment_signal_transport',
choices=['CFN_SIGNAL',
'TEMP_URL_SIGNAL',
'HEAT_SIGNAL'],
default='CFN_SIGNAL',
help=_('Template default for how the server should signal to '
'heat with the deployment output values. CFN_SIGNAL '
'will allow an HTTP POST to a CFN keypair signed URL '
'(requires enabled heat-api-cfn). '
'TEMP_URL_SIGNAL will create a Swift TempURL to be '
'signaled via HTTP PUT (requires object-store endpoint '
'which supports TempURL). '
'HEAT_SIGNAL will allow calls to the Heat API '
'resource-signal using the provided keystone '
'credentials')),
cfg.StrOpt('onready',
help=_('Deprecated.'))]

View File

@ -14,6 +14,7 @@
import copy
import uuid
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import timeutils
@ -29,6 +30,9 @@ from heat.engine.resources import signal_responder
from heat.engine import support
from heat.rpc import api as rpc_api
cfg.CONF.import_opt('default_deployment_signal_transport',
'heat.common.config')
LOG = logging.getLogger(__name__)
@ -152,7 +156,7 @@ class SoftwareDeployment(signal_responder.SignalResponder):
'provided keystone credentials. NO_SIGNAL will result in the '
'resource going to the COMPLETE state without waiting for '
'any signal.'),
default=CFN_SIGNAL,
default=cfg.CONF.default_deployment_signal_transport,
constraints=[
constraints.AllowedValues(SIGNAL_TRANSPORTS),
]

View File

@ -34,6 +34,7 @@ from heat.engine import support
from heat.rpc import api as rpc_api
cfg.CONF.import_opt('instance_user', 'heat.common.config')
cfg.CONF.import_opt('default_software_config_transport', 'heat.common.config')
LOG = logging.getLogger(__name__)
@ -285,7 +286,7 @@ class Server(stack_user.StackUser):
'the Heat API resource-show using the provided keystone '
'credentials. POLL_TEMP_URL will create and populate a '
'Swift TempURL with metadata for polling.'),
default=POLL_SERVER_CFN,
default=cfg.CONF.default_software_config_transport,
constraints=[
constraints.AllowedValues(_SOFTWARE_CONFIG_TRANSPORTS),
]

View File

@ -667,6 +667,8 @@ class ServersTest(common.HeatTestCase):
self.assertEqual('4567', server.access_key)
self.assertEqual('8901', server.secret_key)
self.assertEqual('1234', server._get_user_id())
self.assertEqual('POLL_SERVER_CFN',
server.properties.get('software_config_transport'))
self.assertTrue(stack.access_allowed('4567', 'WebServer'))
self.assertFalse(stack.access_allowed('45678', 'WebServer'))

View File

@ -148,6 +148,7 @@ class SoftwareDeploymentTest(common.HeatTestCase):
props['user_data_format'] = 'SOFTWARE_CONFIG'
self._create_stack(self.template_with_server)
sd = self.deployment
self.assertEqual('CFN_SIGNAL', sd.properties.get('signal_transport'))
sd.validate()
server = self.stack['server']
self.assertTrue(server.user_data_software_config())