From bcfbd8f1c5725bc1921d8b279f5d56abc98e1bad Mon Sep 17 00:00:00 2001 From: Vlad Spoiala Date: Thu, 23 Mar 2023 10:22:19 +0200 Subject: [PATCH] Avoid doing extra AddNewVolWithNaAsync calls. Using a trial and error method to determine the format of AddNewVolWithNaAsync causes issues on some server models. When repeatedly deleting and creating the RAID array on Cyborg with CDI3A2U XCC firmware we occasionally see hanged web sessions and on rare occasions an incorrectly formatted AddNewVolWithNaAsync call will return success and not create the array. To reduce the number of AddNewVolWithNaAsync calls we determine when GetDefaultVolProp requires the extra controller slot number argument and in this case we directly use the AddNewVolWithNaAsync call with the extra controller type argument as these 2 changes go hand in hand in the XCC firmware. This logic reduces the amount of AddNewVolWithNaAsync calls by one and the issues described above can no longer be observed. Change-Id: Icdaa5ef0fb5629ad965e37cbbecdcf892f6e315f --- pyghmi/ipmi/oem/lenovo/imm.py | 15 ++++----------- pyghmi/redfish/oem/lenovo/xcc.py | 15 ++++----------- 2 files changed, 8 insertions(+), 22 deletions(-) diff --git a/pyghmi/ipmi/oem/lenovo/imm.py b/pyghmi/ipmi/oem/lenovo/imm.py index 0d5ab46e..6521ae3d 100644 --- a/pyghmi/ipmi/oem/lenovo/imm.py +++ b/pyghmi/ipmi/oem/lenovo/imm.py @@ -1493,6 +1493,7 @@ class XCCClient(IMMClient): url = '/api/function/raid_conf?params=raidlink_GetDefaultVolProp' args = (url, cid, 0, params['drives']) props = self.wc.grab_json_response(','.join([str(x) for x in args])) + usesctrlslot = False if not props: # newer firmware requires raidlevel too args = (url, cid, params['raidlevel'], 0, params['drives']) props = self.wc.grab_json_response(','.join([str(x) for x in args])) @@ -1501,6 +1502,7 @@ class XCCClient(IMMClient): args = (url, cid, params['raidlevel'], 0, params['drives']) props = self.wc.grab_json_response(','.join([str(x) for x in args])) if 'return' in props and props['return'] == 22: + usesctrlslot = True # Jan 2023 XCC FW - with controller slot number args = (url, cid, params['raidlevel'], 0, params['drives'], cslotno) props = self.wc.grab_json_response(','.join([str(x) for x in args])) @@ -1574,23 +1576,14 @@ class XCCClient(IMMClient): parms = {'raidlink_AddNewVolWithNaAsync': arglist} rsp = self.wc.grab_json_response(url, parms) if rsp['return'] == 14: # newer firmware - if 'supported_cpwb' in props: # June 2022 XCC FW + if 'supported_cpwb' in props and not usesctrlslot: # no ctrl_type arglist = '{0},{1},{2},{3},{4},{5},{6},'.format( cnum, params['raidlevel'], params['spans'], params['perspan'], 0, params['drives'], params['hotspares']) arglist += ''.join(vols) parms = {'raidlink_AddNewVolWithNaAsync': arglist} rsp = self.wc.grab_json_response(url, parms) - if not rsp: # Jan 2023 XCC FW - if cid[2] == 2: - cnum = cid[1] - arglist = '{0},{1},{2},{3},{4},{5},'.format( - cnum, params['raidlevel'], params['spans'], - params['perspan'], params['drives'], params['hotspares']) - arglist += ''.join(vols) + ',{0}'.format(cid[2]) - parms = {'raidlink_AddNewVolWithNaAsync': arglist} - rsp = self.wc.grab_json_response(url, parms) - else: # June 2022 XCC FW + else: # with ctrl_type if cid[2] == 2: cnum = cid[1] arglist = '{0},{1},{2},{3},{4},{5},'.format( diff --git a/pyghmi/redfish/oem/lenovo/xcc.py b/pyghmi/redfish/oem/lenovo/xcc.py index 784d90a3..91fde269 100644 --- a/pyghmi/redfish/oem/lenovo/xcc.py +++ b/pyghmi/redfish/oem/lenovo/xcc.py @@ -815,6 +815,7 @@ class OEMHandler(generic.OEMHandler): url = '/api/function/raid_conf?params=raidlink_GetDefaultVolProp' args = (url, cid, 0, params['drives']) props = self.wc.grab_json_response(','.join([str(x) for x in args])) + usesctrlslot = False if not props: # newer firmware requires raidlevel too args = (url, cid, params['raidlevel'], 0, params['drives']) props = self.wc.grab_json_response(','.join([str(x) for x in args])) @@ -823,6 +824,7 @@ class OEMHandler(generic.OEMHandler): args = (url, cid, params['raidlevel'], 0, params['drives']) props = self.wc.grab_json_response(','.join([str(x) for x in args])) if 'return' in props and props['return'] == 22: + usesctrlslot = True # Jan 2023 XCC FW - with controller slot number args = (url, cid, params['raidlevel'], 0, params['drives'], cslotno) props = self.wc.grab_json_response(','.join([str(x) for x in args])) @@ -897,23 +899,14 @@ class OEMHandler(generic.OEMHandler): parms = {'raidlink_AddNewVolWithNaAsync': arglist} rsp = self.wc.grab_json_response(url, parms) if rsp['return'] == 14: # newer firmware - if 'supported_cpwb' in props: # June 2022 XCC FW + if 'supported_cpwb' in props and not usesctrlslot: # no ctrl_type arglist = '{0},{1},{2},{3},{4},{5},{6},'.format( cnum, params['raidlevel'], params['spans'], params['perspan'], 0, params['drives'], params['hotspares']) arglist += ''.join(vols) parms = {'raidlink_AddNewVolWithNaAsync': arglist} rsp = self.wc.grab_json_response(url, parms) - if not rsp: # Jan 2023 XCC FW - if cid[2] == 2: - cnum = cid[1] - arglist = '{0},{1},{2},{3},{4},{5},'.format( - cnum, params['raidlevel'], params['spans'], - params['perspan'], params['drives'], params['hotspares']) - arglist += ''.join(vols) + ',{0}'.format(cid[2]) - parms = {'raidlink_AddNewVolWithNaAsync': arglist} - rsp = self.wc.grab_json_response(url, parms) - else: # June 2022 XCC FW + else: # with ctrl_type if cid[2] == 2: cnum = cid[1] arglist = '{0},{1},{2},{3},{4},{5},'.format(