Set boot_mode in node properties during OOB Introspection

During OOB Introspection, it adds boot mode as capability
in node properties so that after preparation of overcloud
nodes it will show which node has uefi or bios boot mode
properties respectively.

Change-Id: Iad8060fa13e37a2fa78d998c56d132b11ff948cf
Story: 2005119
This commit is contained in:
Rachit7194 2019-02-27 10:11:43 -05:00
parent a52f615d92
commit a79b150ea7
3 changed files with 22 additions and 3 deletions

View File

@ -23,6 +23,7 @@ from oslo_utils import units
from ironic.common import exception
from ironic.common.i18n import _
from ironic.common import states
from ironic.common import utils
from ironic.drivers import base
from ironic.drivers.modules.drac import common as drac_common
from ironic import objects
@ -84,6 +85,14 @@ class DracInspect(base.InspectInterface):
[self._calculate_cpus(cpu) for cpu in cpus])
properties['cpu_arch'] = 'x86_64' if cpus[0].arch64 else 'x86'
bios_settings = client.list_bios_settings()
current_capabilities = node.properties.get('capabilities', '')
new_capabilities = {
'boot_mode': bios_settings["BootMode"].current_value.lower()}
capabilties = utils.get_updated_capabilities(current_capabilities,
new_capabilities)
properties['capabilities'] = capabilties
virtual_disks = client.list_virtual_disks()
root_disk = self._guess_root_disk(virtual_disks)
if root_disk:

View File

@ -159,7 +159,8 @@ class DracInspectionTestCase(test_utils.BaseDracTest):
'memory_mb': 32768,
'local_gb': 1116,
'cpus': 18,
'cpu_arch': 'x86_64'}
'cpu_arch': 'x86_64',
'capabilities': 'boot_mode:uefi'}
mock_client = mock.Mock()
mock_get_drac_client.return_value = mock_client
mock_client.list_memory.return_value = self.memory
@ -188,6 +189,7 @@ class DracInspectionTestCase(test_utils.BaseDracTest):
mock_client.list_cpus.return_value = self.cpus
mock_client.list_virtual_disks.side_effect = (
drac_exceptions.BaseClientException('boom'))
mock_client.list_bios_settings.return_value = self.bios_boot_settings
with task_manager.acquire(self.context, self.node.uuid,
shared=True) as task:
@ -203,7 +205,8 @@ class DracInspectionTestCase(test_utils.BaseDracTest):
'memory_mb': 32768,
'local_gb': 279,
'cpus': 18,
'cpu_arch': 'x86_64'}
'cpu_arch': 'x86_64',
'capabilities': 'boot_mode:uefi'}
mock_client = mock.Mock()
mock_get_drac_client.return_value = mock_client
mock_client.list_memory.return_value = self.memory
@ -234,6 +237,7 @@ class DracInspectionTestCase(test_utils.BaseDracTest):
mock_client.list_virtual_disks.return_value = []
mock_client.list_physical_disks.return_value = self.physical_disks
mock_client.list_nics.return_value = self.nics
mock_client.list_bios_settings.return_value = self.uefi_boot_settings
with task_manager.acquire(self.context, self.node.uuid,
shared=True) as task:
@ -249,7 +253,8 @@ class DracInspectionTestCase(test_utils.BaseDracTest):
'memory_mb': 32768,
'local_gb': 1116,
'cpus': 18,
'cpu_arch': 'x86_64'}
'cpu_arch': 'x86_64',
'capabilities': 'boot_mode:uefi'}
mock_client = mock.Mock()
mock_get_drac_client.return_value = mock_client
mock_client.list_memory.return_value = self.memory

View File

@ -0,0 +1,5 @@
---
features:
- |
Set boot_mode in node properties during OOB Introspection
for ``idrac`` hardware type.