Merge "Implement managed in-band inspection boot for ilo-virtual-media"

This commit is contained in:
Zuul 2020-02-12 13:09:30 +00:00 committed by Gerrit Code Review
commit 784ddac6ff
3 changed files with 39 additions and 1 deletions

View File

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

View File

@ -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',

View File

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