update_persistent_boot to 'NETWORK' fails on Gen9

update_persistent_boot fails to set the boot device to pxe on gen9.
This patch addresses the issue.

Change-Id: Id6545480015f518fecd1726841fec568a52e75c8
Closes-Bug: 1442481
This commit is contained in:
Anusha Ramineni
2015-04-13 16:11:10 +05:30
parent 373216098e
commit fbc7d30906
3 changed files with 50 additions and 8 deletions

View File

@@ -401,7 +401,7 @@ class RIBCLOperations(operations.IloOperations):
if 'HP iLO Virtual USB CD' in value:
return 'CDROM'
elif 'NIC' in value:
elif 'NIC' in value or 'PXE' in value:
return 'NETWORK'
elif self._isDisk(value):
@@ -479,21 +479,23 @@ class RIBCLOperations(operations.IloOperations):
def _get_nic_boot_devices(self, result):
nw_identifier = "NIC"
pxe_enabled = "PXE"
iscsi_identifier = "iSCSI"
nic_list = []
pxe_nic_list = []
iscsi_nic_list = []
try:
for item in result:
if nw_identifier in item["DESCRIPTION"]:
# Check if it is PXE enabled, to add it to starting of list
if pxe_enabled in item["DESCRIPTION"]:
pxe_nic_list.append(item["value"])
else:
nic_list.append(item["value"])
if pxe_enabled in item["DESCRIPTION"]:
pxe_nic_list.append(item["value"])
elif iscsi_identifier in item["DESCRIPTION"]:
iscsi_nic_list.append(item["value"])
elif nw_identifier in item["DESCRIPTION"]:
nic_list.append(item["value"])
except KeyError as e:
msg = "_get_nic_boot_devices failed with the KeyError:%s"
raise exception.IloError((msg) % e)
all_nics = pxe_nic_list + nic_list
all_nics = pxe_nic_list + nic_list + iscsi_nic_list
return all_nics
def _isDisk(self, result):

View File

@@ -834,6 +834,40 @@ GET_PERSISTENT_BOOT_DEVICE_CDROM_MISSING_UEFI_XML = """
</RIBCL>
"""
GET_NIC_DATA = '''
[
{
"DESCRIPTION": "Slot 1 : Smart Array P840 Controller - 279.37 GiB,\
RAID 0 Logical Drive(Target:0, Lun:0)",
"value": "Boot000E"
},
{
"DESCRIPTION": "Slot1:SmartArrayP840Controller-279.37GiB, RAID0 \
LogicalDrive(Target: 0, Lun: 1)",
"value": "Boot000F"
},
{
"DESCRIPTION": "EmbeddedLOM1 Port1: HPEthernet1Gb4-port331iAdapter-\
NIC(iSCSIIPv4)",
"value": "Boot0004"
},
{
"DESCRIPTION": "EmbeddedLOM1Port2: HPEthernet1Gb4-port331iAdapter-\
NIC(PXEIPv4)",
"value": "Boot0003"
},
{
"DESCRIPTION": "EmbeddedLOM1Port2: HPEthernet1Gb 4-port331iAdapter-\
NIC IPv4",
"value": "Boot0001"
},
{
"DESCRIPTION": "GenericUSBBoot",
"value": "Boot0000"
}
]
'''
GET_HOST_UUID = '''
<RIMP>
<HSI>

View File

@@ -476,6 +476,12 @@ class IloRibclTestCase(unittest.TestCase):
boot_mode = self.ilo._get_server_boot_modes()
self.assertEqual(expected_boot_mode, boot_mode)
def test__get_nic_boot_devices(self):
data = json.loads(constants.GET_NIC_DATA)
expected = ["Boot0003", "Boot0001", "Boot0004"]
result = self.ilo._get_nic_boot_devices(data)
self.assertEqual(result, expected)
class IloRibclTestCaseBeforeRisSupport(unittest.TestCase):