Merge "iRMC:Support preparing rescue ramdisk in iRMC PXE"
This commit is contained in:
commit
cb2b2d191a
@ -1040,7 +1040,7 @@ class IRMCPXEBoot(pxe.PXEBoot):
|
||||
"""iRMC PXE boot."""
|
||||
|
||||
@METRICS.timer('IRMCPXEBoot.prepare_ramdisk')
|
||||
def prepare_ramdisk(self, task, ramdisk_params):
|
||||
def prepare_ramdisk(self, task, ramdisk_params, mode='deploy'):
|
||||
"""Prepares the boot of Ironic ramdisk using PXE.
|
||||
|
||||
This method prepares the boot of the deploy kernel/ramdisk after
|
||||
@ -1051,6 +1051,10 @@ class IRMCPXEBoot(pxe.PXEBoot):
|
||||
:param ramdisk_params: the parameters to be passed to the ramdisk.
|
||||
pxe driver passes these parameters as kernel command-line
|
||||
arguments.
|
||||
:param mode: Label indicating a deploy or rescue operation
|
||||
being carried out on the node. Supported values are
|
||||
'deploy' and 'rescue'. Defaults to 'deploy', indicating
|
||||
deploy operation is being carried out.
|
||||
:returns: None
|
||||
:raises: MissingParameterValue, if some information is missing in
|
||||
node's driver_info or instance_info.
|
||||
@ -1064,7 +1068,8 @@ class IRMCPXEBoot(pxe.PXEBoot):
|
||||
if task.node.provision_state == states.DEPLOYING:
|
||||
irmc_management.backup_bios_config(task)
|
||||
|
||||
super(IRMCPXEBoot, self).prepare_ramdisk(task, ramdisk_params)
|
||||
super(IRMCPXEBoot, self).prepare_ramdisk(task, ramdisk_params,
|
||||
mode=mode)
|
||||
|
||||
@METRICS.timer('IRMCPXEBoot.prepare_instance')
|
||||
def prepare_instance(self, task):
|
||||
|
@ -42,6 +42,7 @@ from ironic.drivers.modules import pxe
|
||||
from ironic.tests.unit.conductor import mgr_utils
|
||||
from ironic.tests.unit.db import base as db_base
|
||||
from ironic.tests.unit.db import utils as db_utils
|
||||
from ironic.tests.unit.drivers.modules import test_pxe
|
||||
from ironic.tests.unit.drivers import third_party_driver_mock_specs \
|
||||
as mock_specs
|
||||
from ironic.tests.unit.objects import utils as obj_utils
|
||||
@ -1229,7 +1230,7 @@ class IRMCPXEBootTestCase(db_base.DbTestCase):
|
||||
task.driver.boot.prepare_ramdisk(task, {})
|
||||
mock_backup_bios.assert_called_once_with(task)
|
||||
mock_parent_prepare.assert_called_once_with(
|
||||
task.driver.boot, task, {})
|
||||
task.driver.boot, task, {}, mode='deploy')
|
||||
|
||||
@mock.patch.object(irmc_management, 'backup_bios_config', spec_set=True,
|
||||
autospec=True)
|
||||
@ -1244,7 +1245,7 @@ class IRMCPXEBootTestCase(db_base.DbTestCase):
|
||||
task.driver.boot.prepare_ramdisk(task, {})
|
||||
self.assertFalse(mock_backup_bios.called)
|
||||
mock_parent_prepare.assert_called_once_with(
|
||||
task.driver.boot, task, {})
|
||||
task.driver.boot, task, {}, mode='deploy')
|
||||
|
||||
@mock.patch.object(irmc_common, 'set_secure_boot_mode', spec_set=True,
|
||||
autospec=True)
|
||||
@ -1799,3 +1800,15 @@ class IRMCVirtualMediaBootWithVolumeTestCase(db_base.DbTestCase):
|
||||
mock_viom.VIOMConfiguration.assert_called_once_with(PARSED_IFNO,
|
||||
self.node.uuid)
|
||||
mock_conf.terminate.assert_called_once_with(reboot=False)
|
||||
|
||||
|
||||
class IRMCPXEBootBasicTestCase(test_pxe.PXEBootTestCase):
|
||||
|
||||
driver = 'pxe_irmc'
|
||||
|
||||
def test_get_properties(self):
|
||||
with task_manager.acquire(self.context, self.node.uuid,
|
||||
shared=True) as task:
|
||||
properties = task.driver.get_properties()
|
||||
for p in pxe.COMMON_PROPERTIES:
|
||||
self.assertIn(p, properties)
|
||||
|
@ -730,6 +730,8 @@ class CleanUpPxeEnvTestCase(db_base.DbTestCase):
|
||||
|
||||
class PXEBootTestCase(db_base.DbTestCase):
|
||||
|
||||
driver = 'fake_pxe'
|
||||
|
||||
def setUp(self):
|
||||
super(PXEBootTestCase, self).setUp()
|
||||
self.context.auth_token = 'fake'
|
||||
@ -737,12 +739,12 @@ class PXEBootTestCase(db_base.DbTestCase):
|
||||
self.config(tftp_root=self.temp_dir, group='pxe')
|
||||
self.temp_dir = tempfile.mkdtemp()
|
||||
self.config(images_path=self.temp_dir, group='pxe')
|
||||
mgr_utils.mock_the_extension_manager(driver="fake_pxe")
|
||||
mgr_utils.mock_the_extension_manager(driver=self.driver)
|
||||
instance_info = INST_INFO_DICT
|
||||
instance_info['deploy_key'] = 'fake-56789'
|
||||
self.node = obj_utils.create_test_node(
|
||||
self.context,
|
||||
driver='fake_pxe',
|
||||
driver=self.driver,
|
||||
instance_info=instance_info,
|
||||
driver_info=DRV_INFO_DICT,
|
||||
driver_internal_info=DRV_INTERNAL_INFO_DICT)
|
||||
@ -814,7 +816,7 @@ class PXEBootTestCase(db_base.DbTestCase):
|
||||
new_node = obj_utils.create_test_node(
|
||||
self.context,
|
||||
uuid='aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee',
|
||||
driver='fake_pxe', instance_info=INST_INFO_DICT,
|
||||
driver=self.driver, instance_info=INST_INFO_DICT,
|
||||
driver_info=DRV_INFO_DICT)
|
||||
with task_manager.acquire(self.context, new_node.uuid,
|
||||
shared=True) as task:
|
||||
|
Loading…
x
Reference in New Issue
Block a user