Merge "Pass global-request-id to ironic-python-agent"

This commit is contained in:
Zuul 2020-08-22 12:36:49 +00:00 committed by Gerrit Code Review
commit 672ce00e26
2 changed files with 12 additions and 4 deletions

View File

@ -744,7 +744,7 @@ def build_instance_pxe_options(task, pxe_info, ipxe_enabled=False):
return pxe_opts
def build_extra_pxe_options(ramdisk_params=None):
def build_extra_pxe_options(task=None, ramdisk_params=None):
# Enable debug in IPA according to CONF.debug if it was not
# specified yet
pxe_append_params = CONF.pxe.pxe_append_params
@ -753,6 +753,9 @@ def build_extra_pxe_options(ramdisk_params=None):
if ramdisk_params:
pxe_append_params += ' ' + ' '.join('%s=%s' % tpl
for tpl in ramdisk_params.items())
if task and task.context.global_id:
pxe_append_params += (
' ipa-global-request-id=%s' % task.context.global_id)
return {'pxe_append_params': pxe_append_params,
'tftp_server': CONF.pxe.tftp_server,
@ -800,7 +803,7 @@ def build_pxe_config_options(task, pxe_info, service=False,
pxe_options.update(build_instance_pxe_options(task, pxe_info,
ipxe_enabled=ipxe_enabled))
pxe_options.update(build_extra_pxe_options(ramdisk_params))
pxe_options.update(build_extra_pxe_options(task, ramdisk_params))
return pxe_options

View File

@ -1249,6 +1249,8 @@ class PXEBuildConfigOptionsTestCase(db_base.DbTestCase):
if ramdisk_params:
expected_pxe_params += ' ' + ' '.join(
'%s=%s' % tpl for tpl in ramdisk_params.items())
expected_pxe_params += (
" ipa-global-request-id=%s" % self.context.global_id)
expected_options = {
'deployment_ari_path': pxe_ramdisk,
@ -1305,8 +1307,8 @@ class PXEBuildConfigOptionsTestCase(db_base.DbTestCase):
del self.node.driver_internal_info['is_whole_disk_image']
self.node.save()
pxe_params = 'my-pxe-append-params ipa-debug=0'
self.config(group='pxe', tftp_server='my-tftp-server')
self.config(group='pxe', pxe_append_params=pxe_params)
self.config(group='pxe', tftp_server='my-tftp-server')
self.config(group='pxe', tftp_root='/tftp-path/')
image_info = {
'deploy_kernel': ('deploy_kernel',
@ -1325,7 +1327,8 @@ class PXEBuildConfigOptionsTestCase(db_base.DbTestCase):
'ari_path': 'no_ramdisk',
'deployment_aki_path': 'path-to-deploy_kernel',
'deployment_ari_path': 'path-to-deploy_ramdisk',
'pxe_append_params': pxe_params,
'pxe_append_params': pxe_params + (
" ipa-global-request-id=%s" % self.context.global_id),
'tftp_server': 'my-tftp-server',
'ipxe_timeout': 0}
self.assertEqual(expected_options, options)
@ -1530,6 +1533,8 @@ class iPXEBuildConfigOptionsTestCase(db_base.DbTestCase):
expected_pxe_params = 'test_param'
if debug:
expected_pxe_params += ' ipa-debug=1'
expected_pxe_params += (
' ipa-global-request-id=%s' % self.context.global_id)
expected_options = {
'deployment_ari_path': pxe_ramdisk,