Avoid cpu_arch None values in iscsi deployments

Ironic will fail iscsi deployments if cpu_arch is not specified.
We need to make cpu_arch optional to prevent that.

Change-Id: I184dc53d664dd8631604f98e34786fa06d04d1ed
Task: 28123
Story: 2004448
This commit is contained in:
Riccardo Pittau 2018-11-28 16:17:09 +01:00
parent f526c03ab3
commit 9298c2db44
3 changed files with 20 additions and 2 deletions

View File

@ -117,8 +117,11 @@ def get_deploy_info(node, address, iqn, port=None, lun='1', conv_flags=None):
'ephemeral_mb': i_info['ephemeral_mb'],
'preserve_ephemeral': i_info['preserve_ephemeral'],
'boot_option': deploy_utils.get_boot_option(node),
'boot_mode': boot_mode_utils.get_boot_mode(node),
'cpu_arch': node.properties.get('cpu_arch')})
'boot_mode': boot_mode_utils.get_boot_mode(node)})
cpu_arch = node.properties.get('cpu_arch')
if cpu_arch is not None:
params['cpu_arch'] = cpu_arch
# Append disk label if specified
disk_label = deploy_utils.get_disk_label(node)

View File

@ -418,6 +418,15 @@ class IscsiDeployMethodsTestCase(db_base.DbTestCase):
ret_val = self._test_get_deploy_info(extra_instance_info=capabilities)
self.assertEqual('local', ret_val['boot_option'])
def test_get_deploy_info_cpu_arch(self):
ret_val = self._test_get_deploy_info()
self.assertEqual('x86_64', ret_val['cpu_arch'])
def test_get_deploy_info_cpu_arch_none(self):
self.node.properties['cpu_arch'] = None
ret_val = self._test_get_deploy_info()
self.assertNotIn('cpu_arch', ret_val)
def test_get_deploy_info_disk_label(self):
capabilities = {'capabilities': {'disk_label': 'msdos'}}
ret_val = self._test_get_deploy_info(extra_instance_info=capabilities)

View File

@ -0,0 +1,6 @@
---
fixes:
- |
Fixes an issue where iSCSI based deployments fail if the ``cpu_arch``
property is not specified on a node.