Merge "Retain "mac" argument for backward compatibility"
This commit is contained in:
commit
bc31ed475f
|
@ -51,7 +51,9 @@ SUPPORTED_RIS_METHODS = [
|
|||
'set_pending_boot_mode',
|
||||
'set_secure_boot_mode',
|
||||
'set_iscsi_boot_info',
|
||||
'set_iscsi_info',
|
||||
'unset_iscsi_boot_info',
|
||||
'unset_iscsi_info',
|
||||
'get_iscsi_initiator_info',
|
||||
'set_iscsi_initiator_info',
|
||||
'set_vm_status',
|
||||
|
@ -88,7 +90,9 @@ SUPPORTED_REDFISH_METHODS = [
|
|||
'get_supported_boot_mode',
|
||||
'get_essential_properties',
|
||||
'set_iscsi_boot_info',
|
||||
'set_iscsi_info',
|
||||
'unset_iscsi_boot_info',
|
||||
'unset_iscsi_info',
|
||||
'get_iscsi_initiator_info',
|
||||
'set_iscsi_initiator_info',
|
||||
]
|
||||
|
@ -271,9 +275,9 @@ class IloClient(operations.IloOperations):
|
|||
"""
|
||||
return self._call_method('set_http_boot_url', url)
|
||||
|
||||
def set_iscsi_boot_info(self, target_name, lun, ip_address,
|
||||
port='3260', auth_method=None, username=None,
|
||||
password=None):
|
||||
def set_iscsi_info(self, target_name, lun, ip_address,
|
||||
port='3260', auth_method=None, username=None,
|
||||
password=None):
|
||||
"""Set iscsi details of the system in uefi boot mode.
|
||||
|
||||
The initiator system is set with the target details like
|
||||
|
@ -289,18 +293,56 @@ class IloClient(operations.IloOperations):
|
|||
:raises: IloCommandNotSupportedInBiosError, if the system is
|
||||
in the bios boot mode.
|
||||
"""
|
||||
return self._call_method('set_iscsi_boot_info', target_name, lun,
|
||||
return self._call_method('set_iscsi_info', target_name, lun,
|
||||
ip_address, port, auth_method, username,
|
||||
password)
|
||||
|
||||
def unset_iscsi_boot_info(self):
|
||||
def set_iscsi_boot_info(self, mac, target_name, lun, ip_address,
|
||||
port='3260', auth_method=None, username=None,
|
||||
password=None):
|
||||
"""Set iscsi details of the system in uefi boot mode.
|
||||
|
||||
The initiator system is set with the target details like
|
||||
IQN, LUN, IP, Port etc.
|
||||
:param mac: The MAC of the NIC to be set with iSCSI information
|
||||
:param target_name: Target Name for iscsi.
|
||||
:param lun: logical unit number.
|
||||
:param ip_address: IP address of the target.
|
||||
:param port: port of the target.
|
||||
:param auth_method : either None or CHAP.
|
||||
:param username: CHAP Username for authentication.
|
||||
:param password: CHAP secret.
|
||||
:raises: IloError, on an error from iLO.
|
||||
:raises: IloCommandNotSupportedInBiosError, if the system is
|
||||
in the bios boot mode.
|
||||
"""
|
||||
LOG.warning("'set_iscsi_boot_info' is deprecated. The 'MAC' parameter"
|
||||
"passed in is ignored. Use 'set_iscsi_info' instead.")
|
||||
return self._call_method('set_iscsi_info', target_name, lun,
|
||||
ip_address, port, auth_method, username,
|
||||
password)
|
||||
|
||||
def unset_iscsi_info(self):
|
||||
"""Disable iscsi boot option of the system in uefi boot mode.
|
||||
|
||||
:raises: IloError, on an error from iLO.
|
||||
:raises: IloCommandNotSupportedInBiosError, if the system is
|
||||
in the bios boot mode.
|
||||
"""
|
||||
return self._call_method('unset_iscsi_boot_info')
|
||||
return self._call_method('unset_iscsi_info')
|
||||
|
||||
def unset_iscsi_boot_info(self, mac):
|
||||
"""Disable iscsi boot option of the system in uefi boot mode.
|
||||
|
||||
:param mac: The MAC of the NIC to be set with iSCSI information.
|
||||
:raises: IloError, on an error from iLO.
|
||||
:raises: IloCommandNotSupportedInBiosError, if the system is
|
||||
in the bios boot mode.
|
||||
"""
|
||||
LOG.warning("'unset_iscsi_boot_info' is deprecated. The 'MAC' "
|
||||
"parameter passed in is ignored. Use 'unset_iscsi_info' "
|
||||
"instead.")
|
||||
return self._call_method('unset_iscsi_info')
|
||||
|
||||
def get_iscsi_initiator_info(self):
|
||||
"""Returns iSCSI initiator information of iLO.
|
||||
|
|
|
@ -64,9 +64,9 @@ class IloOperations(object):
|
|||
"""
|
||||
raise exception.IloCommandNotSupportedError(ERRMSG)
|
||||
|
||||
def set_iscsi_boot_info(self, target_name, lun, ip_address,
|
||||
port='3260', auth_method=None, username=None,
|
||||
password=None):
|
||||
def set_iscsi_info(self, target_name, lun, ip_address,
|
||||
port='3260', auth_method=None, username=None,
|
||||
password=None):
|
||||
"""Set iscsi details of the system in uefi boot mode.
|
||||
|
||||
The initiator system is set with the target details like
|
||||
|
@ -84,7 +84,7 @@ class IloOperations(object):
|
|||
"""
|
||||
raise exception.IloCommandNotSupportedError(ERRMSG)
|
||||
|
||||
def unset_iscsi_boot_info(self):
|
||||
def unset_iscsi_info(self):
|
||||
"""Disable iscsi boot option of the system in uefi boot mode.
|
||||
|
||||
:raises: IloError, on an error from iLO.
|
||||
|
|
|
@ -919,9 +919,9 @@ class RISOperations(rest.RestConnectorBase, operations.IloOperations):
|
|||
msg = 'set_http_boot_url is not supported in the BIOS boot mode'
|
||||
raise exception.IloCommandNotSupportedInBiosError(msg)
|
||||
|
||||
def set_iscsi_boot_info(self, target_name, lun, ip_address,
|
||||
port='3260', auth_method=None, username=None,
|
||||
password=None):
|
||||
def set_iscsi_info(self, target_name, lun, ip_address,
|
||||
port='3260', auth_method=None, username=None,
|
||||
password=None):
|
||||
"""Set iSCSI details of the system in UEFI boot mode.
|
||||
|
||||
The initiator system is set with the target details like
|
||||
|
@ -954,7 +954,7 @@ class RISOperations(rest.RestConnectorBase, operations.IloOperations):
|
|||
msg = 'iSCSI boot is not supported in the BIOS boot mode'
|
||||
raise exception.IloCommandNotSupportedInBiosError(msg)
|
||||
|
||||
def unset_iscsi_boot_info(self):
|
||||
def unset_iscsi_info(self):
|
||||
"""Disable iSCSI boot option in UEFI boot mode.
|
||||
|
||||
:raises: IloError, on an error from iLO.
|
||||
|
|
|
@ -907,9 +907,9 @@ class RedfishOperations(operations.IloOperations):
|
|||
LOG.debug(msg)
|
||||
raise exception.IloError(msg)
|
||||
|
||||
def set_iscsi_boot_info(self, target_name, lun, ip_address,
|
||||
port='3260', auth_method=None, username=None,
|
||||
password=None):
|
||||
def set_iscsi_info(self, target_name, lun, ip_address,
|
||||
port='3260', auth_method=None, username=None,
|
||||
password=None):
|
||||
"""Set iSCSI details of the system in UEFI boot mode.
|
||||
|
||||
The initiator system is set with the target details like
|
||||
|
@ -941,7 +941,7 @@ class RedfishOperations(operations.IloOperations):
|
|||
msg = 'iSCSI boot is not supported in the BIOS boot mode'
|
||||
raise exception.IloCommandNotSupportedInBiosError(msg)
|
||||
|
||||
def unset_iscsi_boot_info(self):
|
||||
def unset_iscsi_info(self):
|
||||
"""Disable iSCSI boot option in UEFI boot mode.
|
||||
|
||||
:raises: IloCommandNotSupportedInBiosError, if the system is
|
||||
|
|
|
@ -339,8 +339,8 @@ class IloClientTestCase(testtools.TestCase):
|
|||
def test__call_method_with_use_redfish_only_set(self, redfish_mock):
|
||||
self.client = client.IloClient("1.2.3.4", "admin", "secret",
|
||||
use_redfish_only=True)
|
||||
redfish_get_host_power_mock = (redfish.RedfishOperations.return_value.
|
||||
get_host_power_status)
|
||||
redfish_get_host_power_mock = (
|
||||
redfish.RedfishOperations.return_value.get_host_power_status)
|
||||
|
||||
self.client._call_method('get_host_power_status')
|
||||
redfish_get_host_power_mock.assert_called_once_with()
|
||||
|
@ -360,12 +360,23 @@ class IloClientTestCase(testtools.TestCase):
|
|||
self.client.set_http_boot_url('fake-url')
|
||||
call_mock.assert_called_once_with('set_http_boot_url', 'fake-url')
|
||||
|
||||
@mock.patch.object(client.IloClient, '_call_method')
|
||||
def test_set_iscsi_info(self, call_mock):
|
||||
self.client.set_iscsi_info('iqn.2011-07.com:example:123',
|
||||
'1', '10.10.1.23', '3260', 'CHAP',
|
||||
'user', 'password')
|
||||
call_mock.assert_called_once_with('set_iscsi_info',
|
||||
'iqn.2011-07.com:example:123',
|
||||
'1', '10.10.1.23', '3260',
|
||||
'CHAP', 'user', 'password')
|
||||
|
||||
@mock.patch.object(client.IloClient, '_call_method')
|
||||
def test_set_iscsi_boot_info(self, call_mock):
|
||||
self.client.set_iscsi_boot_info('iqn.2011-07.com:example:123',
|
||||
self.client.set_iscsi_boot_info('aa:bb:cc:dd:ee:ff',
|
||||
'iqn.2011-07.com:example:123',
|
||||
'1', '10.10.1.23', '3260', 'CHAP',
|
||||
'user', 'password')
|
||||
call_mock.assert_called_once_with('set_iscsi_boot_info',
|
||||
call_mock.assert_called_once_with('set_iscsi_info',
|
||||
'iqn.2011-07.com:example:123',
|
||||
'1', '10.10.1.23', '3260',
|
||||
'CHAP', 'user', 'password')
|
||||
|
@ -375,10 +386,15 @@ class IloClientTestCase(testtools.TestCase):
|
|||
self.client.get_iscsi_initiator_info()
|
||||
call_mock.assert_called_once_with('get_iscsi_initiator_info')
|
||||
|
||||
@mock.patch.object(client.IloClient, '_call_method')
|
||||
def test_unset_iscsi_info(self, call_mock):
|
||||
self.client.unset_iscsi_info()
|
||||
call_mock.assert_called_once_with('unset_iscsi_info')
|
||||
|
||||
@mock.patch.object(client.IloClient, '_call_method')
|
||||
def test_unset_iscsi_boot_info(self, call_mock):
|
||||
self.client.unset_iscsi_boot_info()
|
||||
call_mock.assert_called_once_with('unset_iscsi_boot_info')
|
||||
self.client.unset_iscsi_boot_info("aa:bb:cc:dd:ee:ff")
|
||||
call_mock.assert_called_once_with('unset_iscsi_info')
|
||||
|
||||
@mock.patch.object(client.IloClient, '_call_method')
|
||||
def test_set_iscsi_initiator_info(self, call_mock):
|
||||
|
@ -1018,10 +1034,11 @@ class IloRedfishClientTestCase(testtools.TestCase):
|
|||
*method_args)
|
||||
else:
|
||||
eval('self.client.' + redfish_method_name)()
|
||||
|
||||
self.assertTrue(eval(
|
||||
'self.redfish_mock.return_value.' +
|
||||
redfish_method_name).called)
|
||||
if redfish_method_name not in ('unset_iscsi_boot_info',
|
||||
'set_iscsi_boot_info'):
|
||||
self.assertTrue(eval(
|
||||
'self.redfish_mock.return_value.' +
|
||||
redfish_method_name).called)
|
||||
validate_method_calls.no_test_cases += 1
|
||||
except TypeError:
|
||||
missed_ops.append(redfish_method_name)
|
||||
|
@ -1040,9 +1057,9 @@ class IloRedfishClientTestCase(testtools.TestCase):
|
|||
more_missed_operations, ('arg1', 'arg2'),
|
||||
even_more_missed_operations)
|
||||
if(len(even_more_missed_operations) == 1):
|
||||
self.assertEqual('set_iscsi_boot_info',
|
||||
self.assertEqual('set_iscsi_info',
|
||||
even_more_missed_operations[0])
|
||||
else:
|
||||
self.assertEqual(0, len(even_more_missed_operations))
|
||||
self.assertEqual(len(client.SUPPORTED_REDFISH_METHODS),
|
||||
self.assertEqual(2, len(even_more_missed_operations))
|
||||
self.assertEqual(len(client.SUPPORTED_REDFISH_METHODS) - 2,
|
||||
validate_method_calls.no_test_cases)
|
||||
|
|
|
@ -145,8 +145,8 @@ class IloRisTestCase(testtools.TestCase):
|
|||
|
||||
@mock.patch.object(ris.RISOperations, '_change_iscsi_settings')
|
||||
@mock.patch.object(ris.RISOperations, '_is_boot_mode_uefi')
|
||||
def test_set_iscsi_boot_info_uefi(self, _uefi_boot_mode_mock,
|
||||
change_iscsi_settings_mock):
|
||||
def test_set_iscsi_info_uefi(self, _uefi_boot_mode_mock,
|
||||
change_iscsi_settings_mock):
|
||||
_uefi_boot_mode_mock.return_value = True
|
||||
iscsi_variables = {
|
||||
'iSCSITargetName': 'iqn.2011-07.com.example.server:test1',
|
||||
|
@ -155,7 +155,7 @@ class IloRisTestCase(testtools.TestCase):
|
|||
'iSCSIBootEnable': 'Enabled',
|
||||
'iSCSITargetIpAddress': '10.10.1.30',
|
||||
'iSCSITargetTcpPort': 3260}
|
||||
self.client.set_iscsi_boot_info(
|
||||
self.client.set_iscsi_info(
|
||||
'iqn.2011-07.com.example.server:test1',
|
||||
'1', '10.10.1.30')
|
||||
_uefi_boot_mode_mock.assert_called_once_with()
|
||||
|
@ -163,19 +163,19 @@ class IloRisTestCase(testtools.TestCase):
|
|||
|
||||
@mock.patch.object(ris.RISOperations, '_change_iscsi_settings')
|
||||
@mock.patch.object(ris.RISOperations, '_is_boot_mode_uefi')
|
||||
def test_unset_iscsi_boot_info_uefi(self, _uefi_boot_mode_mock,
|
||||
change_iscsi_settings_mock):
|
||||
def test_unset_iscsi_info_uefi(self, _uefi_boot_mode_mock,
|
||||
change_iscsi_settings_mock):
|
||||
_uefi_boot_mode_mock.return_value = True
|
||||
iscsi_variables = {'iSCSIBootEnable': 'Disabled'}
|
||||
self.client.unset_iscsi_boot_info()
|
||||
self.client.unset_iscsi_info()
|
||||
_uefi_boot_mode_mock.assert_called_once_with()
|
||||
change_iscsi_settings_mock.assert_called_once_with(iscsi_variables)
|
||||
|
||||
@mock.patch.object(ris.RISOperations, '_is_boot_mode_uefi')
|
||||
def test_unset_iscsi_boot_info_bios(self, _uefi_boot_mode_mock):
|
||||
def test_unset_iscsi_info_bios(self, _uefi_boot_mode_mock):
|
||||
_uefi_boot_mode_mock.return_value = False
|
||||
self.assertRaises(exception.IloCommandNotSupportedInBiosError,
|
||||
self.client.unset_iscsi_boot_info)
|
||||
self.client.unset_iscsi_info)
|
||||
_uefi_boot_mode_mock.assert_called_once_with()
|
||||
|
||||
@mock.patch.object(ris.RISOperations, '_rest_get')
|
||||
|
@ -220,10 +220,10 @@ class IloRisTestCase(testtools.TestCase):
|
|||
check_bios_mock.assert_called_once_with()
|
||||
|
||||
@mock.patch.object(ris.RISOperations, '_is_boot_mode_uefi')
|
||||
def test_set_iscsi_boot_info_bios(self, _uefi_boot_mode_mock):
|
||||
def test_set_iscsi_info_bios(self, _uefi_boot_mode_mock):
|
||||
_uefi_boot_mode_mock.return_value = False
|
||||
self.assertRaises(exception.IloCommandNotSupportedInBiosError,
|
||||
self.client.set_iscsi_boot_info,
|
||||
self.client.set_iscsi_info,
|
||||
'iqn.2011-07.com.example.server:test1',
|
||||
'1', '10.10.1.30')
|
||||
_uefi_boot_mode_mock.assert_called_once_with()
|
||||
|
|
|
@ -1046,12 +1046,12 @@ class RedfishOperationsTestCase(testtools.TestCase):
|
|||
|
||||
@mock.patch.object(redfish.RedfishOperations, '_is_boot_mode_uefi',
|
||||
autospec=True)
|
||||
def test_set_iscsi_boot_info_bios(self, _uefi_boot_mode_mock):
|
||||
def test_set_iscsi_info_bios(self, _uefi_boot_mode_mock):
|
||||
_uefi_boot_mode_mock.return_value = False
|
||||
self.assertRaisesRegex(exception.IloCommandNotSupportedInBiosError,
|
||||
'iSCSI boot is not supported '
|
||||
'in the BIOS boot mode',
|
||||
self.rf_client.set_iscsi_boot_info,
|
||||
self.rf_client.set_iscsi_info,
|
||||
'iqn.2011-07.com.example.server:test1',
|
||||
'1', '10.10.1.30')
|
||||
|
||||
|
@ -1059,8 +1059,8 @@ class RedfishOperationsTestCase(testtools.TestCase):
|
|||
'_change_iscsi_target_settings', autospec=True)
|
||||
@mock.patch.object(redfish.RedfishOperations, '_is_boot_mode_uefi',
|
||||
autospec=True)
|
||||
def test_set_iscsi_boot_info_uefi(self, _uefi_boot_mode_mock,
|
||||
change_iscsi_target_settings_mock):
|
||||
def test_set_iscsi_info_uefi(self, _uefi_boot_mode_mock,
|
||||
change_iscsi_target_settings_mock):
|
||||
_uefi_boot_mode_mock.return_value = True
|
||||
iscsi_variables = {
|
||||
'iSCSITargetName': 'iqn.2011-07.com.example.server:test1',
|
||||
|
@ -1069,7 +1069,7 @@ class RedfishOperationsTestCase(testtools.TestCase):
|
|||
'iSCSIConnection': 'Enabled',
|
||||
'iSCSITargetIpAddress': '10.10.1.30',
|
||||
'iSCSITargetTcpPort': 3260}
|
||||
self.rf_client.set_iscsi_boot_info(
|
||||
self.rf_client.set_iscsi_info(
|
||||
'iqn.2011-07.com.example.server:test1',
|
||||
'1', '10.10.1.30')
|
||||
change_iscsi_target_settings_mock.assert_called_once_with(
|
||||
|
@ -1079,7 +1079,7 @@ class RedfishOperationsTestCase(testtools.TestCase):
|
|||
'_change_iscsi_target_settings', autospec=True)
|
||||
@mock.patch.object(redfish.RedfishOperations, '_is_boot_mode_uefi',
|
||||
autospec=True)
|
||||
def test_set_iscsi_boot_info_uefi_with_chap(
|
||||
def test_set_iscsi_info_uefi_with_chap(
|
||||
self, _uefi_boot_mode_mock, change_iscsi_target_settings_mock):
|
||||
_uefi_boot_mode_mock.return_value = True
|
||||
iscsi_variables = {
|
||||
|
@ -1092,7 +1092,7 @@ class RedfishOperationsTestCase(testtools.TestCase):
|
|||
'iSCSIAuthenticationMethod': 'Chap',
|
||||
'iSCSIChapUsername': 'admin',
|
||||
'iSCSIChapSecret': 'password'}
|
||||
self.rf_client.set_iscsi_boot_info(
|
||||
self.rf_client.set_iscsi_info(
|
||||
'iqn.2011-07.com.example.server:test1',
|
||||
'1', '10.10.1.30', 3260, 'CHAP', 'admin', 'password')
|
||||
change_iscsi_target_settings_mock.assert_called_once_with(
|
||||
|
@ -1100,23 +1100,23 @@ class RedfishOperationsTestCase(testtools.TestCase):
|
|||
|
||||
@mock.patch.object(redfish.RedfishOperations, '_is_boot_mode_uefi',
|
||||
autospec=True)
|
||||
def test_unset_iscsi_boot_info_bios(self, _uefi_boot_mode_mock):
|
||||
def test_unset_iscsi_info_bios(self, _uefi_boot_mode_mock):
|
||||
_uefi_boot_mode_mock.return_value = False
|
||||
self.assertRaisesRegex(exception.IloCommandNotSupportedInBiosError,
|
||||
"iSCSI boot is not supported "
|
||||
"in the BIOS boot mode",
|
||||
self.rf_client.unset_iscsi_boot_info)
|
||||
self.rf_client.unset_iscsi_info)
|
||||
|
||||
@mock.patch.object(redfish.RedfishOperations,
|
||||
'_change_iscsi_target_settings', autospec=True)
|
||||
@mock.patch.object(redfish.RedfishOperations, '_is_boot_mode_uefi',
|
||||
autospec=True)
|
||||
def test_unset_iscsi_boot_info_uefi(self, _uefi_boot_mode_mock,
|
||||
change_iscsi_target_settings_mock):
|
||||
def test_unset_iscsi_info_uefi(self, _uefi_boot_mode_mock,
|
||||
change_iscsi_target_settings_mock):
|
||||
_uefi_boot_mode_mock.return_value = True
|
||||
iscsi_variables = {
|
||||
'iSCSIConnection': 'Disabled'}
|
||||
self.rf_client.unset_iscsi_boot_info()
|
||||
self.rf_client.unset_iscsi_info()
|
||||
change_iscsi_target_settings_mock.assert_called_once_with(
|
||||
self.rf_client, iscsi_variables)
|
||||
|
||||
|
|
Loading…
Reference in New Issue