2
0
mirror of https://opendev.org/x/pyghmi synced 2026-05-18 04:07:19 +00:00

Improve Whitley vs Purley storage API detection.

Trying each API call in any order doesn't work correctly for all
cases since the API call for Whitley incorrectly returns success
on the newest Purley firmware and vice versa. The Whitley volume
properties have some extra keys in them. Use one of the extra keys
to differentiate between Purley and Whitley.

Change-Id: Ia18631ec16107492e8753eb4312c56171ebd33f0
This commit is contained in:
Vlad Spoiala
2022-06-28 18:20:53 +03:00
parent fa37941aee
commit 26be05fd30
2 changed files with 17 additions and 15 deletions
+9 -8
View File
@@ -1444,7 +1444,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]))
if not props: # newer firmwarerequires raidlevel too
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]))
props = props['items'][0]
@@ -1517,13 +1517,14 @@ class XCCClient(IMMClient):
parms = {'raidlink_AddNewVolWithNaAsync': arglist}
rsp = self.wc.grab_json_response(url, parms)
if rsp['return'] == 14: # newer firmware
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: # Purley
if 'supported_cpwb' in props: # Whitley
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)
else: # Purley
if cid[2] == 2:
cnum = cid[1]
arglist = '{0},{1},{2},{3},{4},{5},'.format(
+8 -7
View File
@@ -642,13 +642,14 @@ class OEMHandler(generic.OEMHandler):
parms = {'raidlink_AddNewVolWithNaAsync': arglist}
rsp = self.wc.grab_json_response(url, parms)
if rsp['return'] == 14: # newer firmware
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: # Purley
if 'supported_cpwb' in props: # Whitley
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)
else: # Purley
if cid[2] == 2:
cnum = cid[1]
arglist = '{0},{1},{2},{3},{4},{5},'.format(