Add check_storage_configuration to Redfish code.

Change-Id: Id604fdeb19e4dd571f6bad4e9b29276dc7001587
This commit is contained in:
Vlad Spoiala 2023-02-21 18:10:05 +02:00
parent 66e47992a7
commit 14652e8d84
3 changed files with 27 additions and 0 deletions

View File

@ -1268,6 +1268,16 @@ class Command(object):
"""
return self.oem.apply_storage_configuration(cfgspec)
def check_storage_configuration(self, cfgspec=None):
"""Evaluate a configuration for validity
This will check if configuration is currently available and, if given,
whether the specified cfgspec can be applied.
:param cfgspec: A pyghmi.storage.ConfigSpec describing desired oonfig
:return:
"""
return self._oem.check_storage_configuration(cfgspec)
def attach_remote_media(self, url, username=None, password=None):
"""Attach remote media by url

View File

@ -672,6 +672,10 @@ class OEMHandler(object):
raise exc.UnsupportedFunctionality(
'Remote storage configuration not supported on this platform')
def check_storage_configuration(self, cfgspec):
raise exc.UnsupportedFunctionality(
'Remote storage configuration not supported on this platform')
def upload_media(self, filename, progress=None, data=None):
raise exc.UnsupportedFunctionality(
'Remote media upload not supported on this platform')

View File

@ -725,6 +725,19 @@ class OEMHandler(generic.OEMHandler):
themap[raidname] = mapdata
return themap
def check_storage_configuration(self, cfgspec=None):
rsp = self.wc.grab_json_response(
'/api/function/raid_conf?params=raidlink_GetStatus')
if rsp['items'][0]['status'] not in (2, 3):
raise pygexc.TemporaryError('Storage configuration unavailable in '
'current state (try boot to setup or '
'an OS)')
if not cfgspec:
return True
for pool in cfgspec.arrays:
self._parse_storage_cfgspec(pool)
return True
def _wait_storage_async(self):
rsp = {'items': [{'status': 0}]}
while rsp['items'][0]['status'] == 0: