From 2f184f7c40148a1a0974871aefa26058bdb2e9e4 Mon Sep 17 00:00:00 2001 From: Vladyslav Drok Date: Fri, 15 May 2020 18:48:37 +0200 Subject: [PATCH] Pass global-request-id to ironic-python-agent Story: 2007681 Task: 39793 Depends-On: I6f544327d310c976a1625cfb411947591867882a Change-Id: Ia4f7a4ab07e551cc098412b60d1592d31cbc2036 --- ironic/common/pxe_utils.py | 7 +++++-- ironic/tests/unit/common/test_pxe_utils.py | 9 +++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/ironic/common/pxe_utils.py b/ironic/common/pxe_utils.py index 7d0af987cb..a8e90bb774 100644 --- a/ironic/common/pxe_utils.py +++ b/ironic/common/pxe_utils.py @@ -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 diff --git a/ironic/tests/unit/common/test_pxe_utils.py b/ironic/tests/unit/common/test_pxe_utils.py index d37c89d655..fe5d64a519 100644 --- a/ironic/tests/unit/common/test_pxe_utils.py +++ b/ironic/tests/unit/common/test_pxe_utils.py @@ -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,