Updates 'set_one_time_boot' to accept MAC address.
To support setting iscsi target as a one time boot option some code changes were made earlier in the `set_one_time_boot` API of 'RISOperations' class. However this doesn't completely address the issue since the 'RISOperations' object can not be used directly and only can be exposed via 'IloClient' class. This requires the API signature to be changed for the 'IloClient', 'IloOperations' and 'RIBCLOperations' classes. Changes 'set_one_time_boot' API signature to allow to accept MAC value which is required when setting the boot device to iscsi target. Change-Id: Ib47345a69e39e3a8183b84d5645c98c923e80b37 Closes-Bug: 1723863
This commit is contained in:
parent
4ab023bfbe
commit
25f4881730
|
@ -328,9 +328,9 @@ class IloClient(operations.IloOperations):
|
|||
"""
|
||||
return self._call_method('set_host_power', power)
|
||||
|
||||
def set_one_time_boot(self, value):
|
||||
def set_one_time_boot(self, value, mac=None):
|
||||
"""Configures a single boot from a specific device."""
|
||||
return self._call_method('set_one_time_boot', value)
|
||||
return self._call_method('set_one_time_boot', value, mac)
|
||||
|
||||
def insert_virtual_media(self, url, device='FLOPPY'):
|
||||
"""Notifies iLO of the location of a virtual media diskette image."""
|
||||
|
|
|
@ -125,7 +125,7 @@ class IloOperations(object):
|
|||
"""
|
||||
raise exception.IloCommandNotSupportedError(ERRMSG)
|
||||
|
||||
def set_one_time_boot(self, value):
|
||||
def set_one_time_boot(self, value, mac=None):
|
||||
"""Configures a single boot from a specific device."""
|
||||
raise exception.IloCommandNotSupportedError(ERRMSG)
|
||||
|
||||
|
|
|
@ -407,8 +407,15 @@ class RIBCLOperations(operations.IloOperations):
|
|||
raise exception.IloInvalidInputError(
|
||||
"Invalid input. The expected input is ON or OFF.")
|
||||
|
||||
def set_one_time_boot(self, value):
|
||||
"""Configures a single boot from a specific device."""
|
||||
def set_one_time_boot(self, value, mac=None):
|
||||
"""Configures a single boot from a specific device.
|
||||
|
||||
:param value: specific device to which the boot option is set
|
||||
:param mac: MAC value of the data NIC in case ISCSI target is
|
||||
set as boot device. This value may not be used
|
||||
here since RIBCL does not support setting ISCSI
|
||||
target. However included here for consistency.
|
||||
"""
|
||||
dic = {'value': value}
|
||||
data = self._execute_command(
|
||||
'SET_ONE_TIME_BOOT', 'SERVER_INFO', 'write', dic)
|
||||
|
|
|
@ -428,7 +428,13 @@ class IloClientTestCase(testtools.TestCase):
|
|||
@mock.patch.object(client.IloClient, '_call_method')
|
||||
def test_set_one_time_boot(self, call_mock):
|
||||
self.client.set_one_time_boot('CDROM')
|
||||
call_mock.assert_called_once_with('set_one_time_boot', 'CDROM')
|
||||
call_mock.assert_called_once_with('set_one_time_boot', 'CDROM', None)
|
||||
|
||||
@mock.patch.object(client.IloClient, '_call_method')
|
||||
def test_set_one_time_boot_with_mac(self, call_mock):
|
||||
mac = '3863bb43683c'
|
||||
self.client.set_one_time_boot('ISCSI', mac)
|
||||
call_mock.assert_called_once_with('set_one_time_boot', 'ISCSI', mac)
|
||||
|
||||
@mock.patch.object(client.IloClient, '_call_method')
|
||||
def test_insert_virtual_media(self, call_mock):
|
||||
|
@ -801,13 +807,13 @@ class IloClientTestCase(testtools.TestCase):
|
|||
def test_set_one_time_boot_gen9(self, set_one_time_boot_mock):
|
||||
self.client.model = 'Gen9'
|
||||
self.client.set_one_time_boot('cdrom')
|
||||
set_one_time_boot_mock.assert_called_once_with('cdrom')
|
||||
set_one_time_boot_mock.assert_called_once_with('cdrom', None)
|
||||
|
||||
@mock.patch.object(ribcl.RIBCLOperations, 'set_one_time_boot')
|
||||
def test_set_one_time_boot_gen8(self, set_one_time_boot_mock):
|
||||
self.client.model = 'Gen8'
|
||||
self.client.set_one_time_boot('cdrom')
|
||||
set_one_time_boot_mock.assert_called_once_with('cdrom')
|
||||
set_one_time_boot_mock.assert_called_once_with('cdrom', None)
|
||||
|
||||
@mock.patch.object(ris.RISOperations, 'update_persistent_boot')
|
||||
def test_update_persistent_boot_gen9(self, update_persistent_boot_mock):
|
||||
|
|
Loading…
Reference in New Issue