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
This commit is contained in:
Kaifeng Wang 2019-12-02 11:20:48 +08:00
parent 55b7d43291
commit 4ac3cfbf5d
6 changed files with 24 additions and 22 deletions

View File

@ -29,4 +29,11 @@ def parse_args(argv, default_config_files=None):
version=version.version_info.release_string(), version=version.version_info.release_string(),
default_config_files=default_config_files) default_config_files=default_config_files)
rpc.init(cfg.CONF) 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) profiler_opts.set_defaults(cfg.CONF)

View File

@ -106,17 +106,6 @@ opts = [
default={}, default={},
help=_('Bootfile DHCP parameter per node architecture. ' help=_('Bootfile DHCP parameter per node architecture. '
'For example: aarch64:grubaa64.efi')), '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', cfg.StrOpt('ipxe_boot_script',
default=os.path.join( default=os.path.join(
'$pybasedir', 'drivers/modules/boot.ipxe'), '$pybasedir', 'drivers/modules/boot.ipxe'),
@ -149,9 +138,8 @@ opts = [
"If set to false (default), images are downloaded " "If set to false (default), images are downloaded "
"to the ironic-conductor node and served over its " "to the ironic-conductor node and served over its "
"local HTTP server. " "local HTTP server. "
"Applicable only when 'ipxe_enabled' option is " "Applicable only when 'ipxe' compatible boot interface "
"set to true.")), "is used.")),
] ]

View File

@ -52,8 +52,7 @@ class PXEBoot(pxe_base.PXEBaseMixin, base.BootInterface):
# TODO(TheJulia): iscsi_volume_boot should be removed from # TODO(TheJulia): iscsi_volume_boot should be removed from
# the list below once ipxe support is removed from the PXE # the list below once ipxe support is removed from the PXE
# interface. # interface.
capabilities = ['iscsi_volume_boot', 'ramdisk_boot', 'ipxe_boot', capabilities = ['iscsi_volume_boot', 'ramdisk_boot', 'pxe_boot']
'pxe_boot']
def __init__(self): def __init__(self):
# TODO(TheJulia): Once the pxe/ipxe interfaces split is complete, # TODO(TheJulia): Once the pxe/ipxe interfaces split is complete,

View File

@ -21,7 +21,6 @@ import retrying
from ironic.common import cinder from ironic.common import cinder
from ironic.common import exception from ironic.common import exception
from ironic.common.i18n import _ from ironic.common.i18n import _
from ironic.common import pxe_utils
from ironic.common import states from ironic.common import states
from ironic.drivers import base from ironic.drivers import base
from ironic.drivers import utils from ironic.drivers import utils
@ -77,7 +76,10 @@ class CinderStorage(base.StorageInterface):
iscsi_uuids_found = [] iscsi_uuids_found = []
wwpn_found = 0 wwpn_found = 0
wwnn_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: for connector in task.volume_connectors:
if (connector.type in VALID_ISCSI_TYPES if (connector.type in VALID_ISCSI_TYPES
and connector.connector_id is not None): and connector.connector_id is not None):

View File

@ -30,12 +30,10 @@ class CinderInterfaceTestCase(db_base.DbTestCase):
def setUp(self): def setUp(self):
super(CinderInterfaceTestCase, self).setUp() super(CinderInterfaceTestCase, self).setUp()
self.config(ipxe_enabled=True,
group='pxe')
self.config(action_retries=3, self.config(action_retries=3,
action_retry_interval=0, action_retry_interval=0,
group='cinder') group='cinder')
self.config(enabled_boot_interfaces=['fake'], self.config(enabled_boot_interfaces=['fake', 'pxe'],
enabled_storage_interfaces=['noop', 'cinder']) enabled_storage_interfaces=['noop', 'cinder'])
self.interface = cinder.CinderStorage() self.interface = cinder.CinderStorage()
self.node = object_utils.create_test_node(self.context, 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) @mock.patch.object(cinder, 'LOG', autospec=True)
def test_validate_fails_with_ipxe_not_enabled(self, mock_log): def test_validate_fails_with_ipxe_not_enabled(self, mock_log):
"""Ensure a validation failure is raised when iPXE not enabled.""" """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( object_utils.create_test_volume_connector(
self.context, node_id=self.node.id, type='iqn', self.context, node_id=self.node.id, type='iqn',
connector_id='foo.address') connector_id='foo.address')

View File

@ -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.