Implement managed in-band inspection boot for redfish-virtual-media

The current vmedia job is switched to test inspection as well.

Change-Id: I077d9dd4b527fc090833587e62af352b20788458
Story: #1528920
Task: #37646
This commit is contained in:
Dmitry Tantsur 2019-11-27 12:46:22 +01:00 committed by Julia Kreger
parent 2e33669b41
commit 7a7e9689a3
5 changed files with 64 additions and 10 deletions

View File

@ -639,6 +639,21 @@ class RedfishVirtualMediaBoot(base.BootInterface):
if task.driver.storage.should_write_image(task):
self._validate_instance_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:
self._validate_driver_info(task)
except exception.MissingParameterValue:
# Fall back to non-managed in-band inspection
raise exception.UnsupportedDriverExtension(
driver=task.node.driver, extension='inspection')
def prepare_ramdisk(self, task, ramdisk_params):
"""Prepares the boot of deploy or rescue ramdisk over virtual media.
@ -663,7 +678,8 @@ class RedfishVirtualMediaBoot(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
manager_utils.node_power_action(task, states.POWER_OFF)

View File

@ -531,6 +531,27 @@ class RedfishVirtualMediaBootTestCase(db_base.DbTestCase):
self.assertRaises(exception.MissingParameterValue,
task.driver.boot.validate, task)
@mock.patch.object(redfish_utils, 'parse_driver_info', autospec=True)
def test_validate_inspection(self, mock_parse_driver_info):
with task_manager.acquire(self.context, self.node.uuid,
shared=True) as task:
task.node.driver_info.update(
{'deploy_kernel': 'kernel',
'deploy_ramdisk': 'ramdisk',
'bootloader': 'bootloader'}
)
task.driver.boot.validate_inspection(task)
mock_parse_driver_info.assert_called_once_with(task.node)
@mock.patch.object(redfish_utils, 'parse_driver_info', 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(redfish_boot.RedfishVirtualMediaBoot,
'_prepare_deploy_iso', autospec=True)
@mock.patch.object(redfish_boot.RedfishVirtualMediaBoot,

View File

@ -0,0 +1,6 @@
---
features:
- |
The ``redfish-virtual-media`` boot interface now supports managing boot
for in-band inspection. This enables using virtual media instead of PXE
for in-band inspection.

View File

@ -148,11 +148,12 @@
IRONIC_ENABLED_MANAGEMENT_INTERFACES: redfish
- job:
name: ironic-tempest-partition-bios-redfish-vmedia
description: "Deploy ironic node over Redfish virtual media using legacy BIOS boot mode"
name: ironic-tempest-partition-uefi-redfish-vmedia
description: "Deploy ironic node over Redfish virtual media using UEFI boot mode"
parent: ironic-tempest-partition-bios-redfish-pxe
vars:
devstack_localrc:
IRONIC_BOOT_MODE: uefi
IRONIC_ENABLED_BOOT_INTERFACES: redfish-virtual-media
IRONIC_VM_SPECS_RAM: 512
SWIFT_ENABLE_TEMPURLS: True
@ -164,13 +165,23 @@
s-proxy: True
- job:
name: ironic-tempest-partition-uefi-redfish-vmedia
description: "Deploy ironic node over Redfish virtual media using UEFI boot mode"
parent: ironic-tempest-partition-bios-redfish-vmedia
name: ironic-inspector-tempest-partition-bios-redfish-vmedia
description: "Inspect and deploy ironic node over Redfish virtual media using legacy BIOS boot mode"
parent: ironic-tempest-partition-uefi-redfish-vmedia
required-projects:
- openstack/ironic-inspector
vars:
# NOTE(dtantsur): the inspector job includes booting an instance too
tempest_test_regex: Inspector
devstack_localrc:
IRONIC_BOOT_MODE: uefi
IRONIC_VM_SPECS_RAM: 512
IRONIC_BOOT_MODE: bios
IRONIC_INSPECTOR_MANAGED_BOOT: True
IRONIC_INSPECTOR_NODE_NOT_FOUND_HOOK: ''
devstack_plugins:
ironic-inspector: https://opendev.org/openstack/ironic-inspector
devstack_services:
ironic-inspector: True
ironic-inspector-dhcp: True
- job:
name: ironic-tempest-pxe_ipmitool-postgres

View File

@ -17,8 +17,6 @@
- ironic-grenade-dsvm-multinode-multitenant:
voting: false
- ironic-tempest-partition-bios-redfish-pxe
- ironic-tempest-partition-bios-redfish-vmedia:
voting: false
- ironic-tempest-partition-uefi-redfish-vmedia
- ironic-tempest-ipa-partition-pxe_ipmitool-tinyipa
- ironic-tempest-ipa-partition-uefi-pxe_ipmitool-tinyipa
@ -38,6 +36,8 @@
voting: false
- ironic-inspector-tempest-managed:
voting: false
- ironic-inspector-tempest-partition-bios-redfish-vmedia:
voting: false
- ironic-tempest-ipa-wholedisk-bios-ipmi-direct-dib-centos7:
voting: false
- bifrost-integration-tinyipa-ubuntu-xenial: