diff --git a/ironic/drivers/modules/ilo/boot.py b/ironic/drivers/modules/ilo/boot.py index e5b8dc23a0..bd5ab0d042 100644 --- a/ironic/drivers/modules/ilo/boot.py +++ b/ironic/drivers/modules/ilo/boot.py @@ -447,6 +447,21 @@ class IloVirtualMediaBoot(base.BootInterface): else: _validate_instance_image_info(task) + def validate_inspection(self, task): + """Validate that the node has required properties for inspection. + + :param task: A TaskManager instance with the node being checked + :raises: MissingParameterValue if node is missing one or more required + parameters + :raises: UnsupportedDriverExtension + """ + try: + _validate_driver_info(task) + except exception.MissingParameterValue: + # Fall back to non-managed in-band inspection + raise exception.UnsupportedDriverExtension( + driver=task.node.driver, extension='inspection') + @METRICS.timer('IloVirtualMediaBoot.prepare_ramdisk') def prepare_ramdisk(self, task, ramdisk_params): """Prepares the boot of deploy ramdisk using virtual media. @@ -474,7 +489,8 @@ class IloVirtualMediaBoot(base.BootInterface): # modify the state of the node due to virtual media operations. if node.provision_state not in (states.DEPLOYING, states.CLEANING, - states.RESCUING): + states.RESCUING, + states.INSPECTING): return prepare_node_for_deploy(task) diff --git a/ironic/tests/unit/drivers/modules/ilo/test_boot.py b/ironic/tests/unit/drivers/modules/ilo/test_boot.py index 8ff57b09af..46d5195adb 100644 --- a/ironic/tests/unit/drivers/modules/ilo/test_boot.py +++ b/ironic/tests/unit/drivers/modules/ilo/test_boot.py @@ -772,6 +772,22 @@ class IloVirtualMediaBootTestCase(test_common.BaseIloTest): mock_val_driver_info.assert_called_once_with(task) self.assertFalse(mock_val_instance_image_info.called) + @mock.patch.object(ilo_boot, '_validate_driver_info', autospec=True) + def test_validate_inspection(self, mock_val_driver_info): + with task_manager.acquire(self.context, self.node.uuid, + shared=True) as task: + task.node.driver_info['ilo_deploy_iso'] = 'deploy-iso' + task.driver.boot.validate_inspection(task) + mock_val_driver_info.assert_called_once_with(task) + + @mock.patch.object(ilo_common, 'parse_driver_info', spec_set=True, + autospec=True) + def test_validate_inspection_missing(self, mock_parse_driver_info): + with task_manager.acquire(self.context, self.node.uuid, + shared=True) as task: + self.assertRaises(exception.UnsupportedDriverExtension, + task.driver.boot.validate_inspection, task) + @mock.patch.object(ilo_boot, 'prepare_node_for_deploy', spec_set=True, autospec=True) @mock.patch.object(ilo_common, 'eject_vmedia_devices', diff --git a/releasenotes/notes/ilo-managed-inspection-8b549c003224e011.yaml b/releasenotes/notes/ilo-managed-inspection-8b549c003224e011.yaml new file mode 100644 index 0000000000..943f5f6996 --- /dev/null +++ b/releasenotes/notes/ilo-managed-inspection-8b549c003224e011.yaml @@ -0,0 +1,6 @@ +--- +features: + - | + The ``ilo-virtual-media`` boot interface now supports managing boot + for in-band inspection. This enables using virtual media instead of PXE + for in-band inspection.