diff --git a/proliantutils/ilo/client.py b/proliantutils/ilo/client.py index 1f7133c5..88d6a0e2 100644 --- a/proliantutils/ilo/client.py +++ b/proliantutils/ilo/client.py @@ -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.""" diff --git a/proliantutils/ilo/operations.py b/proliantutils/ilo/operations.py index c9c8f7e2..dfd2ee0b 100644 --- a/proliantutils/ilo/operations.py +++ b/proliantutils/ilo/operations.py @@ -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) diff --git a/proliantutils/ilo/ribcl.py b/proliantutils/ilo/ribcl.py index 3a0b9347..93e1fcd7 100644 --- a/proliantutils/ilo/ribcl.py +++ b/proliantutils/ilo/ribcl.py @@ -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) diff --git a/proliantutils/tests/ilo/test_client.py b/proliantutils/tests/ilo/test_client.py index c8121fed..e4216cd3 100644 --- a/proliantutils/tests/ilo/test_client.py +++ b/proliantutils/tests/ilo/test_client.py @@ -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):