Add support for configuring additional architectures for heat-based installs

In this case an additional architecture is any architecture that is NOT
the same as the one running the install.

Blueprint: multiarch-support

Change-Id: Idbf9d52515bddf598792bf4db71c56084c36075c
This commit is contained in:
Tony Breeds 2018-07-06 11:29:40 +10:00
parent 351633e4a3
commit a93e3399b7
5 changed files with 45 additions and 2 deletions

View File

@ -294,6 +294,14 @@ class UndercloudConfig(StandaloneConfig):
'Whether to enable Swift encryption at-rest or '
'not.'
)),
cfg.ListOpt('additional_architectures',
default=[],
help=(_(
'List of additional architectures enabled in '
'your cloud environment. The list of supported '
'values is: %s') %
' '.join(constants.ADDITIONAL_ARCHITECTURES))
),
]
return self.sort_opts(_base_opts + _opts)

View File

@ -72,3 +72,5 @@ CEPH_UPGRADE_PREPARE_ENV = "environments/lifecycle/ceph-upgrade-prepare.yaml"
ENABLE_SSH_ADMIN_TIMEOUT = 300
ENABLE_SSH_ADMIN_STATUS_INTERVAL = 5
ENABLE_SSH_ADMIN_SSH_PORT_TIMEOUT = 300
ADDITIONAL_ARCHITECTURES = ['ppc64le']

View File

@ -25,7 +25,8 @@ class TestUndercloudConfig(base.TestCase):
def test_get_base_opts(self):
ret = self.config.get_base_opts()
expected = ['certificate_generation_ca',
expected = ['additional_architectures',
'certificate_generation_ca',
'clean_nodes',
'cleanup',
'container_images_file',
@ -74,7 +75,8 @@ class TestUndercloudConfig(base.TestCase):
def test_get_opts(self):
ret = self.config.get_opts()
expected = ['certificate_generation_ca',
expected = ['additional_architectures',
'certificate_generation_ca',
'clean_nodes',
'cleanup',
'container_images_file',

View File

@ -316,6 +316,10 @@ def prepare_undercloud_deploy(upgrade=False, no_validations=False,
# This parameter the IP address used to bind the local container registry
env_data['LocalContainerRegistry'] = CONF['local_ip'].split('/')[0]
if CONF['additional_architectures']:
for arch in CONF['additional_architectures']:
env_data['EnableArchitecture%s' % arch.upper()] = True
if CONF.get('local_ip', None):
deploy_args.append('--local-ip=%s' % CONF['local_ip'])

View File

@ -429,6 +429,32 @@ def _run_yum_update(instack_env):
LOG.info(_('yum-update completed successfully'))
def _validate_architecure_options():
def error_handler(message):
LOG.error(_('Undercloud configuration validation failed: %s'), message)
raise FailedValidation(message)
def _validate_ppc64le_exclusive_opts(error_callback):
if 'ipxe_enabled' in CONF and CONF['ipxe_enabled']:
error_callback(_('Currently iPXE boot isn\'t supported with '
'ppc64le systems but is enabled'))
def _validate_additional_architectures(error_callback):
for arch in CONF['additional_architectures']:
if arch not in constants.ADDITIONAL_ARCHITECTURES:
params = {'architecture': arch,
'all_architectures':
' '.join(constants.ADDITIONAL_ARCHITECTURES)
}
error_callback(_('additional_architectures "%(architecture)s" '
'must be in the supported architecture list: '
'%(all_architectures)s') % params)
_validate_additional_architectures(error_handler)
if 'ppc64le' in CONF['additional_architectures']:
_validate_ppc64le_exclusive_opts(error_handler)
def check(verbose_level):
# Fetch configuration and use its log file param to add logging to a file
utils.load_config(CONF, constants.UNDERCLOUD_CONF_PATH)
@ -455,6 +481,7 @@ def check(verbose_level):
_validate_ips()
_validate_interface_exists()
_validate_no_ip_change()
_validate_architecure_options()
except KeyError as e:
LOG.error(_('Key error in configuration: {error}\n'
'Value is missing in configuration.').format(error=e))