From 4ac3cfbf5d2dcb5cc15c8d5202660ad8efb7ee6f Mon Sep 17 00:00:00 2001 From: Kaifeng Wang Date: Mon, 2 Dec 2019 11:20:48 +0800 Subject: [PATCH] Remove the [pxe]ipxe_enabled configuration option The ipxe_enabled configuration option was deprecated for quite a while, this patch removes it. However the code impact by simply removing the configuration option is quite large, so the strategy here is to register the option dynamically but sticks to False, which essentially disabled the ipxe support in the pxe interface. Story: 2007003 Task: 37779 Change-Id: I499e627f780b577e351fd39be5fa93a34d384e64 --- ironic/common/config.py | 7 +++++++ ironic/conf/pxe.py | 16 ++-------------- ironic/drivers/modules/pxe.py | 3 +-- ironic/drivers/modules/storage/cinder.py | 6 ++++-- .../unit/drivers/modules/storage/test_cinder.py | 7 +++---- ...remove-ipxe-enabled-opt-61d106f01c46acab.yaml | 7 +++++++ 6 files changed, 24 insertions(+), 22 deletions(-) create mode 100644 releasenotes/notes/remove-ipxe-enabled-opt-61d106f01c46acab.yaml diff --git a/ironic/common/config.py b/ironic/common/config.py index fedf5c2725..620715c3a0 100644 --- a/ironic/common/config.py +++ b/ironic/common/config.py @@ -29,4 +29,11 @@ def parse_args(argv, default_config_files=None): version=version.version_info.release_string(), default_config_files=default_config_files) rpc.init(cfg.CONF) + # TODO(kaifeng) Remove ipxe_enabled option handling after ipxe support + # is completely removed from the pxe interface. + ipxe_enabled = cfg.BoolOpt('ipxe_enabled', default=False, + deprecated_for_removal=True) + cfg.CONF.register_opt(ipxe_enabled, group='pxe') + cfg.CONF.set_override('ipxe_enabled', False, group='pxe') + profiler_opts.set_defaults(cfg.CONF) diff --git a/ironic/conf/pxe.py b/ironic/conf/pxe.py index 05b955ab80..a54beefa66 100644 --- a/ironic/conf/pxe.py +++ b/ironic/conf/pxe.py @@ -106,17 +106,6 @@ opts = [ default={}, help=_('Bootfile DHCP parameter per node architecture. ' 'For example: aarch64:grubaa64.efi')), - cfg.BoolOpt('ipxe_enabled', - default=False, - help=_('Defaults the PXE interface to only use iPXE.'), - deprecated_for_removal=True, - deprecated_reason=_("This global setting has been " - "superseded by an 'ipxe' boot " - "interface. Set the " - "[default]default_boot_interface " - "to 'ipxe' and/or manually set the node " - "boot interface to 'ipxe' to maintain " - "the same functionality.")), cfg.StrOpt('ipxe_boot_script', default=os.path.join( '$pybasedir', 'drivers/modules/boot.ipxe'), @@ -149,9 +138,8 @@ opts = [ "If set to false (default), images are downloaded " "to the ironic-conductor node and served over its " "local HTTP server. " - "Applicable only when 'ipxe_enabled' option is " - "set to true.")), - + "Applicable only when 'ipxe' compatible boot interface " + "is used.")), ] diff --git a/ironic/drivers/modules/pxe.py b/ironic/drivers/modules/pxe.py index 8ec260cfb1..d783443cd6 100644 --- a/ironic/drivers/modules/pxe.py +++ b/ironic/drivers/modules/pxe.py @@ -52,8 +52,7 @@ class PXEBoot(pxe_base.PXEBaseMixin, base.BootInterface): # TODO(TheJulia): iscsi_volume_boot should be removed from # the list below once ipxe support is removed from the PXE # interface. - capabilities = ['iscsi_volume_boot', 'ramdisk_boot', 'ipxe_boot', - 'pxe_boot'] + capabilities = ['iscsi_volume_boot', 'ramdisk_boot', 'pxe_boot'] def __init__(self): # TODO(TheJulia): Once the pxe/ipxe interfaces split is complete, diff --git a/ironic/drivers/modules/storage/cinder.py b/ironic/drivers/modules/storage/cinder.py index d276148698..5a12f3ff30 100644 --- a/ironic/drivers/modules/storage/cinder.py +++ b/ironic/drivers/modules/storage/cinder.py @@ -21,7 +21,6 @@ import retrying from ironic.common import cinder from ironic.common import exception from ironic.common.i18n import _ -from ironic.common import pxe_utils from ironic.common import states from ironic.drivers import base from ironic.drivers import utils @@ -77,7 +76,10 @@ class CinderStorage(base.StorageInterface): iscsi_uuids_found = [] wwpn_found = 0 wwnn_found = 0 - ipxe_enabled = pxe_utils.is_ipxe_enabled(task) + ipxe_enabled = False + if 'ipxe_boot' in task.driver.boot.capabilities: + ipxe_enabled = True + for connector in task.volume_connectors: if (connector.type in VALID_ISCSI_TYPES and connector.connector_id is not None): diff --git a/ironic/tests/unit/drivers/modules/storage/test_cinder.py b/ironic/tests/unit/drivers/modules/storage/test_cinder.py index fcf7cf2e08..02f2a56f2b 100644 --- a/ironic/tests/unit/drivers/modules/storage/test_cinder.py +++ b/ironic/tests/unit/drivers/modules/storage/test_cinder.py @@ -30,12 +30,10 @@ class CinderInterfaceTestCase(db_base.DbTestCase): def setUp(self): super(CinderInterfaceTestCase, self).setUp() - self.config(ipxe_enabled=True, - group='pxe') self.config(action_retries=3, action_retry_interval=0, group='cinder') - self.config(enabled_boot_interfaces=['fake'], + self.config(enabled_boot_interfaces=['fake', 'pxe'], enabled_storage_interfaces=['noop', 'cinder']) self.interface = cinder.CinderStorage() self.node = object_utils.create_test_node(self.context, @@ -290,7 +288,8 @@ class CinderInterfaceTestCase(db_base.DbTestCase): @mock.patch.object(cinder, 'LOG', autospec=True) def test_validate_fails_with_ipxe_not_enabled(self, mock_log): """Ensure a validation failure is raised when iPXE not enabled.""" - self.config(ipxe_enabled=False, group='pxe') + self.node.boot_interface = 'pxe' + self.node.save() object_utils.create_test_volume_connector( self.context, node_id=self.node.id, type='iqn', connector_id='foo.address') diff --git a/releasenotes/notes/remove-ipxe-enabled-opt-61d106f01c46acab.yaml b/releasenotes/notes/remove-ipxe-enabled-opt-61d106f01c46acab.yaml new file mode 100644 index 0000000000..2fee8a7c9d --- /dev/null +++ b/releasenotes/notes/remove-ipxe-enabled-opt-61d106f01c46acab.yaml @@ -0,0 +1,7 @@ +--- +upgrade: + - | + The configuration option ``[pxe]ipxe_enabled`` was deprecated and now has + been removed, thus the support for iPXE from the ``pxe`` interface was + removed. To use iPXE, the boot interface should be migrated to ``ipxe`` or + other boot interfaces capable of booting from iPXE.