Merge "Add a flag to always perform persistent boot on PXE interface"

This commit is contained in:
Jenkins 2017-08-10 15:44:34 +00:00 committed by Gerrit Code Review
commit 3d8626dc10
5 changed files with 63 additions and 1 deletions

View File

@ -13,6 +13,14 @@ nodes, and runs processes inside of a ramdisk.
For more information on this, see :ref:`IPA`.
PXE Boot Interface
------------------
.. toctree::
:maxdepth: 1
drivers/pxe
IPMITool driver
---------------

View File

@ -0,0 +1,26 @@
.. pxe:
==============================
Configuring PXE boot interface
==============================
Enable persistent boot device for deploy/clean operation
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ironic uses non-persistent boot for cleaning/deploying phases as default,
in PXE interface. For some drivers, a persistent change is far more
costly than a non-persistent one, so this can bring performance improvements.
Enable persistent boot device on node
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Set the flag ``force_persistent_boot_device`` to ``True`` in the node's ``driver_info``::
$ openstack baremetal node set --driver-info force_persistent_boot_device=True <node>
.. note::
It's recommended to check if the node's state has not changed as there
is no way of locking the node between these commands.
Once the flag is present, the next cleaning and deploy steps will be done
with persistent boot for that node.

View File

@ -21,6 +21,7 @@ from ironic_lib import metrics_utils
from ironic_lib import utils as ironic_utils
from oslo_log import log as logging
from oslo_utils import fileutils
from oslo_utils import strutils
from ironic.common import boot_devices
from ironic.common import dhcp_factory
@ -484,8 +485,11 @@ class PXEBoot(base.BootInterface):
pxe_utils.create_pxe_config(task, pxe_options,
pxe_config_template)
persistent = strutils.bool_from_string(
node.driver_info.get('force_persistent_boot_device',
False))
manager_utils.node_set_boot_device(task, boot_devices.PXE,
persistent=False)
persistent=persistent)
if CONF.pxe.ipxe_enabled and CONF.pxe.ipxe_use_swift:
pxe_info.pop('deploy_kernel', None)

View File

@ -1150,6 +1150,21 @@ class PXEBootTestCase(db_base.DbTestCase):
boot_devices.DISK,
persistent=True)
@mock.patch.object(manager_utils, 'node_set_boot_device', autospec=True)
@mock.patch.object(pxe_utils, 'clean_up_pxe_config', autospec=True)
def test_is_force_persistent_boot_device_enabled(
self, clean_up_pxe_config_mock, set_boot_device_mock):
with task_manager.acquire(self.context, self.node.uuid) as task:
task.node.instance_info['capabilities'] = {'boot_option': 'local'}
task.driver.boot.prepare_instance(task)
clean_up_pxe_config_mock.assert_called_once_with(task)
driver_info = task.node.driver_info
driver_info['force_persistent _boot_device'] = True
task.node.driver_info = driver_info
set_boot_device_mock.assert_called_once_with(task,
boot_devices.DISK,
persistent=True)
@mock.patch.object(manager_utils, 'node_set_boot_device', autospec=True)
@mock.patch.object(pxe_utils, 'clean_up_pxe_config', autospec=True)
def test_prepare_instance_localboot_active(self, clean_up_pxe_config_mock,

View File

@ -0,0 +1,9 @@
---
features:
- |
Adds a boolean flag called ``force_persistent_boot_device`` into
a node's ``driver_info`` to enable persistent behavior when you
set the boot device during deploy and cleaning operations. This
flag will override a non-persistent behavior in the cleaning and
deploy process.
For more information, see https://bugs.launchpad.net/ironic/+bug/1703945.