Rename ilo_boot_iso -> boot_iso

Change-Id: Ie758cccdf8a7bc30389cd5d4cd83ea80dbae040f
This commit is contained in:
Dmitry Tantsur 2021-06-14 16:51:46 +02:00
parent 349bf2d5bc
commit e84b6d1020
7 changed files with 90 additions and 68 deletions

View File

@ -294,7 +294,7 @@ Node configuration
``driver_info`` if ``ilo-virtual-media`` boot interface is used: ``driver_info`` if ``ilo-virtual-media`` boot interface is used:
- ``deploy_iso``: The glance UUID of the deploy ramdisk ISO image. - ``deploy_iso``: The glance UUID of the deploy ramdisk ISO image.
- ``instance info/ilo_boot_iso`` property to be either boot iso - ``instance info/boot_iso`` property to be either boot iso
Glance UUID or a HTTP(S) URL. This is optional property and is used when Glance UUID or a HTTP(S) URL. This is optional property and is used when
``boot_option`` is set to ``netboot`` or ``ramdisk``. ``boot_option`` is set to ``netboot`` or ``ramdisk``.
@ -303,6 +303,10 @@ Node configuration
configured to use ``ramdisk`` deploy interface. See :ref:`ramdisk-deploy` configured to use ``ramdisk`` deploy interface. See :ref:`ramdisk-deploy`
for details. for details.
.. note::
The ``boot_iso`` property used to be called ``ilo_boot_iso`` before
the Xena release.
- ``rescue_iso``: The glance UUID of the rescue ISO image. This is optional - ``rescue_iso``: The glance UUID of the rescue ISO image. This is optional
property and is used when ``rescue`` interface is set to ``agent``. property and is used when ``rescue`` interface is set to ``agent``.
@ -1043,7 +1047,7 @@ HTTP(S) Based Deploy Support
The user input for the images given in ``driver_info`` like ``deploy_iso``, The user input for the images given in ``driver_info`` like ``deploy_iso``,
``deploy_kernel`` and ``deploy_ramdisk`` and in ``instance_info`` like ``deploy_kernel`` and ``deploy_ramdisk`` and in ``instance_info`` like
``image_source``, ``kernel``, ``ramdisk`` and ``ilo_boot_iso`` may also be given as ``image_source``, ``kernel``, ``ramdisk`` and ``boot_iso`` may also be given as
HTTP(S) URLs. HTTP(S) URLs.
The HTTP(S) web server can be configured in many ways. For the Apache The HTTP(S) web server can be configured in many ways. For the Apache

View File

@ -124,7 +124,7 @@ def _get_boot_iso(task, root_uuid):
"""This method returns a boot ISO to boot the node. """This method returns a boot ISO to boot the node.
It chooses one of the three options in the order as below: It chooses one of the three options in the order as below:
1. Does nothing if 'ilo_boot_iso' is present in node's instance_info. 1. Does nothing if 'boot_iso' is present in node's instance_info.
2. Image deployed has a meta-property 'boot_iso' in Glance. This should 2. Image deployed has a meta-property 'boot_iso' in Glance. This should
refer to the UUID of the boot_iso which exists in Glance. refer to the UUID of the boot_iso which exists in Glance.
3. Returns a boot ISO created on the fly using kernel and ramdisk 3. Returns a boot ISO created on the fly using kernel and ramdisk
@ -146,16 +146,18 @@ def _get_boot_iso(task, root_uuid):
value in the node's driver_info or instance_info. value in the node's driver_info or instance_info.
:raises: SwiftOperationError, if operation with Swift fails. :raises: SwiftOperationError, if operation with Swift fails.
:raises: ImageCreationFailed, if creation of boot ISO failed. :raises: ImageCreationFailed, if creation of boot ISO failed.
:raises: exception.ImageRefValidationFailed if ilo_boot_iso is not :raises: exception.ImageRefValidationFailed if boot_iso is not
HTTP(S) URL. HTTP(S) URL.
""" """
LOG.debug("Trying to get a boot ISO to boot the baremetal node") LOG.debug("Trying to get a boot ISO to boot the baremetal node")
# Option 1 - Check if user has provided ilo_boot_iso in node's # Option 1 - Check if user has provided boot_iso in node's
# instance_info # instance_info
if task.node.instance_info.get('ilo_boot_iso'): boot_iso = driver_utils.get_field(task.node, 'boot_iso',
LOG.debug("Using ilo_boot_iso provided in node's instance_info") deprecated_prefix='ilo',
boot_iso = task.node.instance_info['ilo_boot_iso'] collection='instance_info')
if boot_iso:
LOG.debug("Using boot_iso provided in node's instance_info")
if not service_utils.is_glance_image(boot_iso): if not service_utils.is_glance_image(boot_iso):
try: try:
image_service.HttpImageService().validate_href(boot_iso) image_service.HttpImageService().validate_href(boot_iso)
@ -163,11 +165,11 @@ def _get_boot_iso(task, root_uuid):
with excutils.save_and_reraise_exception(): with excutils.save_and_reraise_exception():
LOG.error("Virtual media deploy accepts only Glance " LOG.error("Virtual media deploy accepts only Glance "
"images or HTTP(S) URLs as " "images or HTTP(S) URLs as "
"instance_info['ilo_boot_iso']. Either %s " "instance_info['boot_iso']. Either %s "
"is not a valid HTTP(S) URL or is " "is not a valid HTTP(S) URL or is "
"not reachable.", boot_iso) "not reachable.", boot_iso)
return task.node.instance_info['ilo_boot_iso'] return boot_iso
# Option 2 - Check if user has provided a boot_iso in Glance. If boot_iso # Option 2 - Check if user has provided a boot_iso in Glance. If boot_iso
# is a supported non-glance href execution will proceed to option 3. # is a supported non-glance href execution will proceed to option 3.
@ -339,8 +341,10 @@ class IloVirtualMediaBoot(base.BootInterface):
""" """
node = task.node node = task.node
boot_option = deploy_utils.get_boot_option(node) boot_option = deploy_utils.get_boot_option(node)
boot_iso = node.instance_info.get('ilo_boot_iso') boot_iso = driver_utils.get_field(node, 'boot_iso',
if (boot_option == "ramdisk" and boot_iso): deprecated_prefix='ilo',
collection='instance_info')
if boot_option == "ramdisk" and boot_iso:
if not service_utils.is_glance_image(boot_iso): if not service_utils.is_glance_image(boot_iso):
try: try:
image_service.HttpImageService().validate_href(boot_iso) image_service.HttpImageService().validate_href(boot_iso)
@ -349,7 +353,7 @@ class IloVirtualMediaBoot(base.BootInterface):
LOG.error("Virtual media deploy with 'ramdisk' " LOG.error("Virtual media deploy with 'ramdisk' "
"boot_option accepts only Glance images or " "boot_option accepts only Glance images or "
"HTTP(S) URLs as " "HTTP(S) URLs as "
"instance_info['ilo_boot_iso']. Either %s " "instance_info['boot_iso']. Either %s "
"is not a valid HTTP(S) URL or is not " "is not a valid HTTP(S) URL or is not "
"reachable.", boot_iso) "reachable.", boot_iso)
return return
@ -409,12 +413,13 @@ class IloVirtualMediaBoot(base.BootInterface):
prepare_node_for_deploy(task) prepare_node_for_deploy(task)
# Clear ilo_boot_iso if it's a glance image to force recreate # Clear boot_iso if it's a glance image to force recreate
# another one again (or use existing one in glance). # another one again (or use existing one in glance).
# This is mainly for rebuild and rescue scenario. # This is mainly for rebuild and rescue scenario.
if service_utils.is_glance_image( if service_utils.is_glance_image(
node.instance_info.get('image_source')): node.instance_info.get('image_source')):
instance_info = node.instance_info instance_info = node.instance_info
instance_info.pop('boot_iso', None)
instance_info.pop('ilo_boot_iso', None) instance_info.pop('ilo_boot_iso', None)
node.instance_info = instance_info node.instance_info = instance_info
node.save() node.save()
@ -584,7 +589,7 @@ class IloVirtualMediaBoot(base.BootInterface):
persistent=True) persistent=True)
i_info = node.instance_info i_info = node.instance_info
i_info['ilo_boot_iso'] = boot_iso i_info['boot_iso'] = boot_iso
node.instance_info = i_info node.instance_info = i_info
node.save() node.save()
@ -951,8 +956,10 @@ class IloUefiHttpsBoot(base.BootInterface):
"The node is required to be in 'UEFI' boot mode.") "The node is required to be in 'UEFI' boot mode.")
raise exception.InvalidParameterValue(error) raise exception.InvalidParameterValue(error)
boot_iso = node.instance_info.get('ilo_boot_iso') boot_iso = driver_utils.get_field(node, 'boot_iso',
if (boot_option == "ramdisk" and boot_iso): deprecated_prefix='ilo',
collection='instance_info')
if boot_option == "ramdisk" and boot_iso:
if not service_utils.is_glance_image(boot_iso): if not service_utils.is_glance_image(boot_iso):
try: try:
image_service.HttpImageService().validate_href(boot_iso) image_service.HttpImageService().validate_href(boot_iso)
@ -961,7 +968,7 @@ class IloUefiHttpsBoot(base.BootInterface):
LOG.error("UEFI-HTTPS boot with 'ramdisk' " LOG.error("UEFI-HTTPS boot with 'ramdisk' "
"boot_option accepts only Glance images or " "boot_option accepts only Glance images or "
"HTTPS URLs as " "HTTPS URLs as "
"instance_info['ilo_boot_iso']. Either %s " "instance_info['boot_iso']. Either %s "
"is not a valid HTTPS URL or is not " "is not a valid HTTPS URL or is not "
"reachable.", boot_iso) "reachable.", boot_iso)
return return
@ -1018,12 +1025,13 @@ class IloUefiHttpsBoot(base.BootInterface):
prepare_node_for_deploy(task) prepare_node_for_deploy(task)
# Clear ilo_boot_iso if it's a glance image to force recreate # Clear boot_iso if it's a glance image to force recreate
# another one again (or use existing one in glance). # another one again (or use existing one in glance).
# This is mainly for rebuild and rescue scenario. # This is mainly for rebuild and rescue scenario.
if service_utils.is_glance_image( if service_utils.is_glance_image(
node.instance_info.get('image_source')): node.instance_info.get('image_source')):
instance_info = node.instance_info instance_info = node.instance_info
instance_info.pop('boot_iso', None)
instance_info.pop('ilo_boot_iso', None) instance_info.pop('ilo_boot_iso', None)
node.instance_info = instance_info node.instance_info = instance_info
node.save() node.save()
@ -1129,7 +1137,7 @@ class IloUefiHttpsBoot(base.BootInterface):
if boot_option != 'ramdisk': if boot_option != 'ramdisk':
i_info = node.instance_info i_info = node.instance_info
i_info['ilo_boot_iso'] = iso_ref i_info['boot_iso'] = iso_ref
node.instance_info = i_info node.instance_info = i_info
node.save() node.save()

View File

@ -30,6 +30,7 @@ from ironic.conductor import utils as manager_utils
from ironic.conf import CONF from ironic.conf import CONF
from ironic.drivers import base from ironic.drivers import base
from ironic.drivers.modules.ilo import common as ilo_common from ironic.drivers.modules.ilo import common as ilo_common
from ironic.drivers import utils as driver_utils
ilo_error = importutils.try_import('proliantutils.exception') ilo_error = importutils.try_import('proliantutils.exception')
@ -42,24 +43,26 @@ def _attach_boot_iso_if_needed(task):
"""Attaches boot ISO for a deployed node. """Attaches boot ISO for a deployed node.
This method checks the instance info of the baremetal node for a This method checks the instance info of the baremetal node for a
boot iso. If the instance info has a value of key 'ilo_boot_iso', boot iso. If the instance info has a value of key 'boot_iso',
it indicates that 'boot_option' is 'netboot'. Therefore it attaches it indicates that 'boot_option' is 'netboot'. Therefore it attaches
the boot ISO on the baremetal node and then sets the node to boot from the boot ISO on the baremetal node and then sets the node to boot from
virtual media cdrom. virtual media cdrom.
:param task: a TaskManager instance containing the node to act on. :param task: a TaskManager instance containing the node to act on.
""" """
i_info = task.node.instance_info
node_state = task.node.provision_state node_state = task.node.provision_state
# NOTE: On instance rebuild, ilo_boot_iso will be present in # NOTE: On instance rebuild, boot_iso will be present in
# instance_info but the node will be in DEPLOYING state. # instance_info but the node will be in DEPLOYING state.
# In such a scenario, the ilo_boot_iso shouldn't be # In such a scenario, the boot_iso shouldn't be
# attached to the node while powering on the node (the node # attached to the node while powering on the node (the node
# should boot from deploy ramdisk instead, which will already # should boot from deploy ramdisk instead, which will already
# be attached by the deploy driver). # be attached by the deploy driver).
if 'ilo_boot_iso' in i_info and node_state == states.ACTIVE: boot_iso = driver_utils.get_field(task.node, 'boot_iso',
ilo_common.setup_vmedia_for_boot(task, i_info['ilo_boot_iso']) deprecated_prefix='ilo',
collection='instance_info')
if boot_iso and node_state == states.ACTIVE:
ilo_common.setup_vmedia_for_boot(task, boot_iso)
manager_utils.node_set_boot_device(task, boot_devices.CDROM) manager_utils.node_set_boot_device(task, boot_devices.CDROM)

View File

@ -406,18 +406,20 @@ def get_kernel_append_params(node, default):
return default return default
def get_field(node, name, deprecated_prefix=None, use_conf=False): def get_field(node, name, deprecated_prefix=None, use_conf=False,
collection='driver_info'):
"""Get a driver_info field with deprecated prefix.""" """Get a driver_info field with deprecated prefix."""
value = node.driver_info.get(name) node_coll = getattr(node, collection)
value = node_coll.get(name)
if value or not deprecated_prefix: if value or not deprecated_prefix:
return value return value
deprecated_name = f'{deprecated_prefix}_{name}' deprecated_name = f'{deprecated_prefix}_{name}'
value = node.driver_info.get(deprecated_name) value = node_coll.get(deprecated_name)
if value: if value:
LOG.warning("The driver_info field %s of node %s is deprecated, " LOG.warning("The %s field %s of node %s is deprecated, "
"please use %s instead", "please use %s instead",
deprecated_name, node.uuid, name) collection, deprecated_name, node.uuid, name)
return value return value
if use_conf: if use_conf:

View File

@ -161,7 +161,7 @@ class IloBootPrivateMethodsTestCase(test_common.BaseIloTest):
def test__get_boot_iso_http_url(self, service_mock): def test__get_boot_iso_http_url(self, service_mock):
url = 'http://abc.org/image/qcow2' url = 'http://abc.org/image/qcow2'
i_info = self.node.instance_info i_info = self.node.instance_info
i_info['ilo_boot_iso'] = url i_info['boot_iso'] = url
self.node.instance_info = i_info self.node.instance_info = i_info
self.node.save() self.node.save()
@ -178,7 +178,7 @@ class IloBootPrivateMethodsTestCase(test_common.BaseIloTest):
image_href='file://img.qcow2', reason='fail') image_href='file://img.qcow2', reason='fail')
url = 'file://img.qcow2' url = 'file://img.qcow2'
i_info = self.node.instance_info i_info = self.node.instance_info
i_info['ilo_boot_iso'] = url i_info['boot_iso'] = url
self.node.instance_info = i_info self.node.instance_info = i_info
self.node.save() self.node.save()
@ -445,7 +445,7 @@ class IloVirtualMediaBootTestCase(test_common.BaseIloTest):
def test_validate(self, mock_val_instance_image_info, def test_validate(self, mock_val_instance_image_info,
mock_val_driver_info, storage_mock): mock_val_driver_info, storage_mock):
instance_info = self.node.instance_info instance_info = self.node.instance_info
instance_info['ilo_boot_iso'] = 'deploy-iso' instance_info['boot_iso'] = 'deploy-iso'
instance_info['image_source'] = '6b2f0c0c-79e8-4db6-842e-43c9764204af' instance_info['image_source'] = '6b2f0c0c-79e8-4db6-842e-43c9764204af'
self.node.instance_info = instance_info self.node.instance_info = instance_info
self.node.save() self.node.save()
@ -469,7 +469,7 @@ class IloVirtualMediaBootTestCase(test_common.BaseIloTest):
val_driver_info_mock): val_driver_info_mock):
instance_info = self.node.instance_info instance_info = self.node.instance_info
boot_iso = '6b2f0c0c-79e8-4db6-842e-43c9764204af' boot_iso = '6b2f0c0c-79e8-4db6-842e-43c9764204af'
instance_info['ilo_boot_iso'] = boot_iso instance_info['boot_iso'] = boot_iso
instance_info['capabilities'] = '{"boot_option": "ramdisk"}' instance_info['capabilities'] = '{"boot_option": "ramdisk"}'
self.node.instance_info = instance_info self.node.instance_info = instance_info
self.node.save() self.node.save()
@ -492,7 +492,7 @@ class IloVirtualMediaBootTestCase(test_common.BaseIloTest):
val_driver_info_mock): val_driver_info_mock):
instance_info = self.node.instance_info instance_info = self.node.instance_info
boot_iso = 'http://myserver/boot.iso' boot_iso = 'http://myserver/boot.iso'
instance_info['ilo_boot_iso'] = boot_iso instance_info['boot_iso'] = boot_iso
instance_info['capabilities'] = '{"boot_option": "ramdisk"}' instance_info['capabilities'] = '{"boot_option": "ramdisk"}'
self.node.instance_info = instance_info self.node.instance_info = instance_info
self.node.save() self.node.save()
@ -520,7 +520,7 @@ class IloVirtualMediaBootTestCase(test_common.BaseIloTest):
validate_href_mock.side_effect = exception.ImageRefValidationFailed( validate_href_mock.side_effect = exception.ImageRefValidationFailed(
image_href='http://myserver/boot.iso', reason='fail') image_href='http://myserver/boot.iso', reason='fail')
boot_iso = 'http://myserver/boot.iso' boot_iso = 'http://myserver/boot.iso'
instance_info['ilo_boot_iso'] = boot_iso instance_info['boot_iso'] = boot_iso
instance_info['capabilities'] = '{"boot_option": "ramdisk"}' instance_info['capabilities'] = '{"boot_option": "ramdisk"}'
self.node.instance_info = instance_info self.node.instance_info = instance_info
self.node.save() self.node.save()
@ -537,7 +537,7 @@ class IloVirtualMediaBootTestCase(test_common.BaseIloTest):
self.assertFalse(val_driver_info_mock.called) self.assertFalse(val_driver_info_mock.called)
self.assertIn("Virtual media deploy with 'ramdisk' boot_option " self.assertIn("Virtual media deploy with 'ramdisk' boot_option "
"accepts only Glance images or HTTP(S) URLs as " "accepts only Glance images or HTTP(S) URLs as "
"instance_info['ilo_boot_iso'].", "instance_info['boot_iso'].",
log_mock.call_args[0][0]) log_mock.call_args[0][0])
@mock.patch.object(noop_storage.NoopStorage, 'should_write_image', @mock.patch.object(noop_storage.NoopStorage, 'should_write_image',
@ -587,7 +587,7 @@ class IloVirtualMediaBootTestCase(test_common.BaseIloTest):
ramdisk_params={'a': 'b'}, ramdisk_params={'a': 'b'},
mode='deploy'): mode='deploy'):
instance_info = self.node.instance_info instance_info = self.node.instance_info
instance_info['ilo_boot_iso'] = ilo_boot_iso instance_info['boot_iso'] = ilo_boot_iso
instance_info['image_source'] = image_source instance_info['image_source'] = image_source
self.node.instance_info = instance_info self.node.instance_info = instance_info
self.node.save() self.node.save()
@ -635,7 +635,7 @@ class IloVirtualMediaBootTestCase(test_common.BaseIloTest):
image_source='6b2f0c0c-79e8-4db6-842e-43c9764204af', image_source='6b2f0c0c-79e8-4db6-842e-43c9764204af',
mode='rescue') mode='rescue')
self.node.refresh() self.node.refresh()
self.assertNotIn('ilo_boot_iso', self.node.instance_info) self.assertNotIn('boot_iso', self.node.instance_info)
def test_prepare_ramdisk_rescue_not_a_glance_image(self): def test_prepare_ramdisk_rescue_not_a_glance_image(self):
self.node.provision_state = states.RESCUING self.node.provision_state = states.RESCUING
@ -646,7 +646,7 @@ class IloVirtualMediaBootTestCase(test_common.BaseIloTest):
mode='rescue') mode='rescue')
self.node.refresh() self.node.refresh()
self.assertEqual('http://mybootiso', self.assertEqual('http://mybootiso',
self.node.instance_info['ilo_boot_iso']) self.node.instance_info['boot_iso'])
def test_prepare_ramdisk_glance_image(self): def test_prepare_ramdisk_glance_image(self):
self.node.provision_state = states.DEPLOYING self.node.provision_state = states.DEPLOYING
@ -655,7 +655,7 @@ class IloVirtualMediaBootTestCase(test_common.BaseIloTest):
ilo_boot_iso='swift:abcdef', ilo_boot_iso='swift:abcdef',
image_source='6b2f0c0c-79e8-4db6-842e-43c9764204af') image_source='6b2f0c0c-79e8-4db6-842e-43c9764204af')
self.node.refresh() self.node.refresh()
self.assertNotIn('ilo_boot_iso', self.node.instance_info) self.assertNotIn('boot_iso', self.node.instance_info)
def test_prepare_ramdisk_not_a_glance_image(self): def test_prepare_ramdisk_not_a_glance_image(self):
self.node.provision_state = states.DEPLOYING self.node.provision_state = states.DEPLOYING
@ -665,7 +665,7 @@ class IloVirtualMediaBootTestCase(test_common.BaseIloTest):
image_source='http://myimage') image_source='http://myimage')
self.node.refresh() self.node.refresh()
self.assertEqual('http://mybootiso', self.assertEqual('http://mybootiso',
self.node.instance_info['ilo_boot_iso']) self.node.instance_info['boot_iso'])
def test_prepare_ramdisk_glance_image_cleaning(self): def test_prepare_ramdisk_glance_image_cleaning(self):
self.node.provision_state = states.CLEANING self.node.provision_state = states.CLEANING
@ -674,7 +674,7 @@ class IloVirtualMediaBootTestCase(test_common.BaseIloTest):
ilo_boot_iso='swift:abcdef', ilo_boot_iso='swift:abcdef',
image_source='6b2f0c0c-79e8-4db6-842e-43c9764204af') image_source='6b2f0c0c-79e8-4db6-842e-43c9764204af')
self.node.refresh() self.node.refresh()
self.assertNotIn('ilo_boot_iso', self.node.instance_info) self.assertNotIn('boot_iso', self.node.instance_info)
def test_prepare_ramdisk_not_a_glance_image_cleaning(self): def test_prepare_ramdisk_not_a_glance_image_cleaning(self):
self.node.provision_state = states.CLEANING self.node.provision_state = states.CLEANING
@ -684,7 +684,7 @@ class IloVirtualMediaBootTestCase(test_common.BaseIloTest):
image_source='http://myimage') image_source='http://myimage')
self.node.refresh() self.node.refresh()
self.assertEqual('http://mybootiso', self.assertEqual('http://mybootiso',
self.node.instance_info['ilo_boot_iso']) self.node.instance_info['boot_iso'])
@mock.patch.object(ilo_boot, 'prepare_node_for_deploy', @mock.patch.object(ilo_boot, 'prepare_node_for_deploy',
spec_set=True, autospec=True) spec_set=True, autospec=True)
@ -752,7 +752,7 @@ class IloVirtualMediaBootTestCase(test_common.BaseIloTest):
set_boot_device_mock.assert_called_once_with( set_boot_device_mock.assert_called_once_with(
task, boot_devices.CDROM, persistent=True) task, boot_devices.CDROM, persistent=True)
self.assertEqual('boot.iso', self.assertEqual('boot.iso',
task.node.instance_info['ilo_boot_iso']) task.node.instance_info['boot_iso'])
@mock.patch.object(manager_utils, 'node_set_boot_device', spec_set=True, @mock.patch.object(manager_utils, 'node_set_boot_device', spec_set=True,
autospec=True) autospec=True)
@ -1447,13 +1447,13 @@ class IloUefiHttpsBootTestCase(db_base.DbTestCase):
'bootloader': 'bootloader' 'bootloader': 'bootloader'
} }
get_img_inst_mock.return_value = { get_img_inst_mock.return_value = {
'ilo_boot_iso': 'boot-iso', 'boot_iso': 'boot-iso',
'image_source': '6b2f0c0c-79e8-4db6-842e-43c9764204af' 'image_source': '6b2f0c0c-79e8-4db6-842e-43c9764204af'
} }
instance_info = self.node.instance_info instance_info = self.node.instance_info
driver_info = self.node.driver_info driver_info = self.node.driver_info
instance_info['ilo_boot_iso'] = 'boot-iso' instance_info['boot_iso'] = 'boot-iso'
instance_info['image_source'] = '6b2f0c0c-79e8-4db6-842e-43c9764204af' instance_info['image_source'] = '6b2f0c0c-79e8-4db6-842e-43c9764204af'
self.node.instance_info = instance_info self.node.instance_info = instance_info
@ -1469,7 +1469,7 @@ class IloUefiHttpsBootTestCase(db_base.DbTestCase):
'deploy_kernel': 'deploy-kernel', 'deploy_kernel': 'deploy-kernel',
'deploy_ramdisk': 'deploy-ramdisk', 'deploy_ramdisk': 'deploy-ramdisk',
'bootloader': 'bootloader', 'bootloader': 'bootloader',
'ilo_boot_iso': 'boot-iso', 'boot_iso': 'boot-iso',
'image_source': '6b2f0c0c-79e8-4db6-842e-43c9764204af' 'image_source': '6b2f0c0c-79e8-4db6-842e-43c9764204af'
} }
@ -1610,7 +1610,7 @@ class IloUefiHttpsBootTestCase(db_base.DbTestCase):
self, glance_mock, get_image_inst_mock, validate_image_mock, self, glance_mock, get_image_inst_mock, validate_image_mock,
validate_href_mock): validate_href_mock):
instance_info = { instance_info = {
'ilo_boot_iso': 'boot-iso', 'boot_iso': 'boot-iso',
'image_source': '6b2f0c0c-79e8-4db6-842e-43c9764204af' 'image_source': '6b2f0c0c-79e8-4db6-842e-43c9764204af'
} }
driver_internal_info = self.node.driver_internal_info driver_internal_info = self.node.driver_internal_info
@ -1646,7 +1646,7 @@ class IloUefiHttpsBootTestCase(db_base.DbTestCase):
validate_href_mock): validate_href_mock):
instance_info = { instance_info = {
'ilo_boot_iso': 'boot-iso', 'boot_iso': 'boot-iso',
'image_source': '6b2f0c0c-79e8-4db6-842e-43c9764204af' 'image_source': '6b2f0c0c-79e8-4db6-842e-43c9764204af'
} }
driver_internal_info = self.node.driver_internal_info driver_internal_info = self.node.driver_internal_info
@ -1681,7 +1681,7 @@ class IloUefiHttpsBootTestCase(db_base.DbTestCase):
self, glance_mock, get_image_inst_mock, validate_image_mock, self, glance_mock, get_image_inst_mock, validate_image_mock,
validate_href_mock): validate_href_mock):
instance_info = { instance_info = {
'ilo_boot_iso': 'boot-iso', 'boot_iso': 'boot-iso',
'image_source': '6b2f0c0c-79e8-4db6-842e-43c9764204af' 'image_source': '6b2f0c0c-79e8-4db6-842e-43c9764204af'
} }
driver_internal_info = self.node.driver_internal_info or {} driver_internal_info = self.node.driver_internal_info or {}
@ -1714,7 +1714,7 @@ class IloUefiHttpsBootTestCase(db_base.DbTestCase):
get_boot_mock.return_value = 'UEFI' get_boot_mock.return_value = 'UEFI'
instance_info = self.node.instance_info instance_info = self.node.instance_info
instance_info['ilo_boot_iso'] = 'boot-iso' instance_info['boot_iso'] = 'boot-iso'
instance_info['image_source'] = '6b2f0c0c-79e8-4db6-842e-43c9764204af' instance_info['image_source'] = '6b2f0c0c-79e8-4db6-842e-43c9764204af'
self.node.instance_info = instance_info self.node.instance_info = instance_info
self.node.save() self.node.save()
@ -1767,7 +1767,7 @@ class IloUefiHttpsBootTestCase(db_base.DbTestCase):
get_boot_mock.return_value = 'UEFI' get_boot_mock.return_value = 'UEFI'
instance_info = self.node.instance_info instance_info = self.node.instance_info
boot_iso = '6b2f0c0c-79e8-4db6-842e-43c9764204af' boot_iso = '6b2f0c0c-79e8-4db6-842e-43c9764204af'
instance_info['ilo_boot_iso'] = boot_iso instance_info['boot_iso'] = boot_iso
instance_info['capabilities'] = '{"boot_option": "ramdisk"}' instance_info['capabilities'] = '{"boot_option": "ramdisk"}'
self.node.instance_info = instance_info self.node.instance_info = instance_info
self.node.save() self.node.save()
@ -1794,7 +1794,7 @@ class IloUefiHttpsBootTestCase(db_base.DbTestCase):
get_boot_mock.return_value = 'UEFI' get_boot_mock.return_value = 'UEFI'
instance_info = self.node.instance_info instance_info = self.node.instance_info
boot_iso = 'http://myserver/boot.iso' boot_iso = 'http://myserver/boot.iso'
instance_info['ilo_boot_iso'] = boot_iso instance_info['boot_iso'] = boot_iso
instance_info['capabilities'] = '{"boot_option": "ramdisk"}' instance_info['capabilities'] = '{"boot_option": "ramdisk"}'
self.node.instance_info = instance_info self.node.instance_info = instance_info
self.node.save() self.node.save()
@ -1824,7 +1824,7 @@ class IloUefiHttpsBootTestCase(db_base.DbTestCase):
validate_href_mock.side_effect = exception.ImageRefValidationFailed( validate_href_mock.side_effect = exception.ImageRefValidationFailed(
image_href='http://myserver/boot.iso', reason='fail') image_href='http://myserver/boot.iso', reason='fail')
boot_iso = 'http://myserver/boot.iso' boot_iso = 'http://myserver/boot.iso'
instance_info['ilo_boot_iso'] = boot_iso instance_info['boot_iso'] = boot_iso
instance_info['capabilities'] = '{"boot_option": "ramdisk"}' instance_info['capabilities'] = '{"boot_option": "ramdisk"}'
self.node.instance_info = instance_info self.node.instance_info = instance_info
self.node.save() self.node.save()
@ -1841,7 +1841,7 @@ class IloUefiHttpsBootTestCase(db_base.DbTestCase):
self.assertFalse(val_driver_info_mock.called) self.assertFalse(val_driver_info_mock.called)
self.assertIn("UEFI-HTTPS boot with 'ramdisk' boot_option " self.assertIn("UEFI-HTTPS boot with 'ramdisk' boot_option "
"accepts only Glance images or HTTPS URLs as " "accepts only Glance images or HTTPS URLs as "
"instance_info['ilo_boot_iso'].", "instance_info['boot_iso'].",
log_mock.call_args[0][0]) log_mock.call_args[0][0])
@mock.patch.object(ilo_boot.IloUefiHttpsBoot, '_validate_driver_info', @mock.patch.object(ilo_boot.IloUefiHttpsBoot, '_validate_driver_info',
@ -1886,7 +1886,7 @@ class IloUefiHttpsBootTestCase(db_base.DbTestCase):
self.node.provision_state = state self.node.provision_state = state
self.node.save() self.node.save()
instance_info = self.node.instance_info instance_info = self.node.instance_info
instance_info['ilo_boot_iso'] = ilo_boot_iso instance_info['boot_iso'] = ilo_boot_iso
instance_info['image_source'] = image_source instance_info['image_source'] = image_source
self.node.instance_info = instance_info self.node.instance_info = instance_info
self.node.save() self.node.save()
@ -1927,7 +1927,7 @@ class IloUefiHttpsBootTestCase(db_base.DbTestCase):
image_source='6b2f0c0c-79e8-4db6-842e-43c9764204af', image_source='6b2f0c0c-79e8-4db6-842e-43c9764204af',
mode='rescue', state=states.RESCUING) mode='rescue', state=states.RESCUING)
self.node.refresh() self.node.refresh()
self.assertNotIn('ilo_boot_iso', self.node.instance_info) self.assertNotIn('boot_iso', self.node.instance_info)
def test_prepare_ramdisk_rescue_not_a_glance_image(self): def test_prepare_ramdisk_rescue_not_a_glance_image(self):
self._test_prepare_ramdisk( self._test_prepare_ramdisk(
@ -1936,14 +1936,14 @@ class IloUefiHttpsBootTestCase(db_base.DbTestCase):
mode='rescue', state=states.RESCUING) mode='rescue', state=states.RESCUING)
self.node.refresh() self.node.refresh()
self.assertEqual('http://mybootiso', self.assertEqual('http://mybootiso',
self.node.instance_info['ilo_boot_iso']) self.node.instance_info['boot_iso'])
def test_prepare_ramdisk_glance_image(self): def test_prepare_ramdisk_glance_image(self):
self._test_prepare_ramdisk( self._test_prepare_ramdisk(
ilo_boot_iso='swift:abcdef', ilo_boot_iso='swift:abcdef',
image_source='6b2f0c0c-79e8-4db6-842e-43c9764204af') image_source='6b2f0c0c-79e8-4db6-842e-43c9764204af')
self.node.refresh() self.node.refresh()
self.assertNotIn('ilo_boot_iso', self.node.instance_info) self.assertNotIn('boot_iso', self.node.instance_info)
def test_prepare_ramdisk_not_a_glance_image(self): def test_prepare_ramdisk_not_a_glance_image(self):
self._test_prepare_ramdisk( self._test_prepare_ramdisk(
@ -1951,7 +1951,7 @@ class IloUefiHttpsBootTestCase(db_base.DbTestCase):
image_source='http://myimage') image_source='http://myimage')
self.node.refresh() self.node.refresh()
self.assertEqual('http://mybootiso', self.assertEqual('http://mybootiso',
self.node.instance_info['ilo_boot_iso']) self.node.instance_info['boot_iso'])
def test_prepare_ramdisk_glance_image_cleaning(self): def test_prepare_ramdisk_glance_image_cleaning(self):
self._test_prepare_ramdisk( self._test_prepare_ramdisk(
@ -1959,7 +1959,7 @@ class IloUefiHttpsBootTestCase(db_base.DbTestCase):
image_source='6b2f0c0c-79e8-4db6-842e-43c9764204af', image_source='6b2f0c0c-79e8-4db6-842e-43c9764204af',
mode='deploy', state=states.CLEANING) mode='deploy', state=states.CLEANING)
self.node.refresh() self.node.refresh()
self.assertNotIn('ilo_boot_iso', self.node.instance_info) self.assertNotIn('boot_iso', self.node.instance_info)
def test_prepare_ramdisk_not_a_glance_image_cleaning(self): def test_prepare_ramdisk_not_a_glance_image_cleaning(self):
self._test_prepare_ramdisk( self._test_prepare_ramdisk(
@ -1968,7 +1968,7 @@ class IloUefiHttpsBootTestCase(db_base.DbTestCase):
mode='deploy', state=states.CLEANING) mode='deploy', state=states.CLEANING)
self.node.refresh() self.node.refresh()
self.assertEqual('http://mybootiso', self.assertEqual('http://mybootiso',
self.node.instance_info['ilo_boot_iso']) self.node.instance_info['boot_iso'])
@mock.patch.object(image_utils, 'cleanup_iso_image', spec_set=True, @mock.patch.object(image_utils, 'cleanup_iso_image', spec_set=True,
autospec=True) autospec=True)
@ -2058,7 +2058,7 @@ class IloUefiHttpsBootTestCase(db_base.DbTestCase):
update_secureboot_mock.assert_called_once_with(task) update_secureboot_mock.assert_called_once_with(task)
setup_uefi_https_mock.assert_called_once_with( setup_uefi_https_mock.assert_called_once_with(
task, "recreated-iso", True) task, "recreated-iso", True)
self.assertEqual(task.node.instance_info['ilo_boot_iso'], self.assertEqual(task.node.instance_info['boot_iso'],
"recreated-iso") "recreated-iso")
@mock.patch.object(boot_mode_utils, 'configure_secure_boot_if_needed', @mock.patch.object(boot_mode_utils, 'configure_secure_boot_if_needed',
@ -2100,7 +2100,7 @@ class IloUefiHttpsBootTestCase(db_base.DbTestCase):
update_secureboot_mock.assert_called_once_with(task) update_secureboot_mock.assert_called_once_with(task)
setup_uefi_https_mock.assert_called_once_with( setup_uefi_https_mock.assert_called_once_with(
task, "recreated-iso", True) task, "recreated-iso", True)
self.assertTrue('ilo_boot_iso' not in task.node.instance_info) self.assertTrue('boot_iso' not in task.node.instance_info)
@mock.patch.object(boot_mode_utils, 'deconfigure_secure_boot_if_needed', @mock.patch.object(boot_mode_utils, 'deconfigure_secure_boot_if_needed',
spec_set=True, autospec=True) spec_set=True, autospec=True)

View File

@ -344,7 +344,7 @@ class IloPowerInternalMethodsTestCase(test_common.BaseIloTest):
with task_manager.acquire(self.context, self.node.uuid, with task_manager.acquire(self.context, self.node.uuid,
shared=True) as task: shared=True) as task:
task.node.provision_state = states.ACTIVE task.node.provision_state = states.ACTIVE
task.node.instance_info['ilo_boot_iso'] = 'boot-iso' task.node.instance_info['boot_iso'] = 'boot-iso'
ilo_power._attach_boot_iso_if_needed(task) ilo_power._attach_boot_iso_if_needed(task)
setup_vmedia_mock.assert_called_once_with(task, 'boot-iso') setup_vmedia_mock.assert_called_once_with(task, 'boot-iso')
set_boot_device_mock.assert_called_once_with(task, set_boot_device_mock.assert_called_once_with(task,
@ -360,7 +360,7 @@ class IloPowerInternalMethodsTestCase(test_common.BaseIloTest):
with task_manager.acquire(self.context, self.node.uuid, with task_manager.acquire(self.context, self.node.uuid,
shared=True) as task: shared=True) as task:
task.node.provision_state = states.DEPLOYING task.node.provision_state = states.DEPLOYING
task.node.instance_info['ilo_boot_iso'] = 'boot-iso' task.node.instance_info['boot_iso'] = 'boot-iso'
ilo_power._attach_boot_iso_if_needed(task) ilo_power._attach_boot_iso_if_needed(task)
self.assertFalse(setup_vmedia_mock.called) self.assertFalse(setup_vmedia_mock.called)
self.assertFalse(set_boot_device_mock.called) self.assertFalse(set_boot_device_mock.called)

View File

@ -0,0 +1,5 @@
---
deprecations:
- |
The ``driver_info`` property ``ilo_boot_iso`` has been renamed to
just ``boot_iso``.