Follow-up patch for UEFI iSCSI boot nic adapter fix
This commit addresses comments on UEFI iSCSI boot patch for multiple nic adapter support. Change-Id: I626bb5db7d496a68c622fdd6ab6c2fa3ecff07fc
This commit is contained in:
parent
94d4e1c372
commit
bdb14f3419
|
@ -607,6 +607,7 @@ class RISOperations(rest.RestConnectorBase, operations.IloOperations):
|
||||||
def _get_uefi_device_path_by_mac(self, mac):
|
def _get_uefi_device_path_by_mac(self, mac):
|
||||||
"""Return uefi device path of mac.
|
"""Return uefi device path of mac.
|
||||||
|
|
||||||
|
:param mac: Mac address.
|
||||||
:returns: Uefi Device path.
|
:returns: Uefi Device path.
|
||||||
Ex. 'PciRoot(0x0)/Pci(0x2,0x3)/Pci(0x0,0x0)'
|
Ex. 'PciRoot(0x0)/Pci(0x2,0x3)/Pci(0x0,0x0)'
|
||||||
"""
|
"""
|
||||||
|
@ -621,6 +622,7 @@ class RISOperations(rest.RestConnectorBase, operations.IloOperations):
|
||||||
def _get_nic_association_name_by_mac(self, mac):
|
def _get_nic_association_name_by_mac(self, mac):
|
||||||
"""Return nic association name by mac address
|
"""Return nic association name by mac address
|
||||||
|
|
||||||
|
:param mac: Mac address.
|
||||||
:returns: Nic association name. Ex. NicBoot1
|
:returns: Nic association name. Ex. NicBoot1
|
||||||
"""
|
"""
|
||||||
headers, bios_uri, bios_settings = self._check_bios_resource()
|
headers, bios_uri, bios_settings = self._check_bios_resource()
|
||||||
|
@ -658,7 +660,7 @@ class RISOperations(rest.RestConnectorBase, operations.IloOperations):
|
||||||
macs_available = self._get_all_macs()
|
macs_available = self._get_all_macs()
|
||||||
if not set(macs).issubset(macs_available):
|
if not set(macs).issubset(macs_available):
|
||||||
msg = ("Given macs: %(macs)s not found in the system"
|
msg = ("Given macs: %(macs)s not found in the system"
|
||||||
% {'macs': str(macs)})
|
% {'macs': list(set(macs) - set(macs_available))})
|
||||||
raise exception.InvalidInputError(msg)
|
raise exception.InvalidInputError(msg)
|
||||||
|
|
||||||
def _change_iscsi_settings(self, iscsi_info, macs=[]):
|
def _change_iscsi_settings(self, iscsi_info, macs=[]):
|
||||||
|
|
|
@ -65,7 +65,5 @@ class EthernetInterfaceCollection(base.ResourceCollectionBase):
|
||||||
|
|
||||||
def get_all_macs(self):
|
def get_all_macs(self):
|
||||||
"""Return list of macs available on system"""
|
"""Return list of macs available on system"""
|
||||||
macs = []
|
macs = [mac.mac_address.lower() for mac in self.get_members()]
|
||||||
for mac in self.get_members():
|
|
||||||
macs.append(mac.mac_address.lower())
|
|
||||||
return macs
|
return macs
|
||||||
|
|
|
@ -637,12 +637,13 @@ class HPESystem(system.System):
|
||||||
macs_available = self.ethernet_interfaces.get_all_macs()
|
macs_available = self.ethernet_interfaces.get_all_macs()
|
||||||
if not set(macs).issubset(macs_available):
|
if not set(macs).issubset(macs_available):
|
||||||
msg = ("Given macs: %(macs)s not found in the system"
|
msg = ("Given macs: %(macs)s not found in the system"
|
||||||
% {'macs': str(macs)})
|
% {'macs': list(set(macs) - set(macs_available))})
|
||||||
raise exception.InvalidInputError(msg)
|
raise exception.InvalidInputError(msg)
|
||||||
|
|
||||||
def get_nic_association_name_by_mac(self, mac):
|
def get_nic_association_name_by_mac(self, mac):
|
||||||
"""Return nic association name by mac address
|
"""Return nic association name by mac address
|
||||||
|
|
||||||
|
:mac: Mac address.
|
||||||
:returns: Nic association name. Ex. NicBoot1
|
:returns: Nic association name. Ex. NicBoot1
|
||||||
"""
|
"""
|
||||||
mappings = self.bios_settings.bios_mappings.pci_settings_mappings
|
mappings = self.bios_settings.bios_mappings.pci_settings_mappings
|
||||||
|
|
|
@ -1170,10 +1170,12 @@ class HPESystemTestCase(testtools.TestCase):
|
||||||
'ethernet_interface_collection.json')
|
'ethernet_interface_collection.json')
|
||||||
with open(path, 'r') as f:
|
with open(path, 'r') as f:
|
||||||
eth_coll = json.loads(f.read())
|
eth_coll = json.loads(f.read())
|
||||||
self.conn.get.return_value.json.side_effect = eth_coll
|
self.conn.get.return_value.json.side_effect = [eth_coll]
|
||||||
get_all_macs_mock.return_value = [
|
get_all_macs_mock.return_value = [
|
||||||
'12:44:6a:3b:04:11', '13:44:6a:3b:04:13']
|
'12:44:6a:3b:04:11', '13:44:6a:3b:04:13']
|
||||||
self.assertRaisesRegex(
|
self.assertRaisesRegex(
|
||||||
exception.InvalidInputError,
|
exception.InvalidInputError,
|
||||||
"Given macs: \['12:44:6A:3B:04:15'\] not found in the system",
|
"Given macs: \['14:23:AD:3B:4C:78'\] "
|
||||||
self.sys_inst.validate_macs, ['12:44:6A:3B:04:15'])
|
"not found in the system",
|
||||||
|
self.sys_inst.validate_macs,
|
||||||
|
['12:44:6a:3b:04:11', '14:23:AD:3B:4C:78'])
|
||||||
|
|
Loading…
Reference in New Issue