2
0
mirror of https://opendev.org/x/pyghmi synced 2025-01-31 05:17:39 +00:00

Add reseat to redfish command for XCC

This will allow XCC users doing redfish to reseat
using the HTTPS api.

Change-Id: Ib0582f4aafb20cd94972f2080df673fbd3abbab3
This commit is contained in:
Jarrod Johnson 2021-03-03 15:12:31 -05:00
parent 944a239205
commit 86845c4e2b
3 changed files with 25 additions and 0 deletions

View File

@ -527,6 +527,17 @@ class Command(object):
currinfo = self._do_web_request(self.sysurl, cache=False)
return {'powerstate': str(currinfo['PowerState'].lower())}
def reseat_bay(self, bay):
"""Request the reseat of a bay
Request the enclosure manager to reseat the system in a particular
bay.
:param bay: The bay identifier to reseat
:return:
"""
self.oem.reseat_bay(bay)
def set_power(self, powerstate, wait=False):
if powerstate == 'boot':
oldpowerstate = self.get_power()['powerstate']

View File

@ -398,3 +398,7 @@ class OEMHandler(object):
def get_user_expiration(self, uid):
return None
def reseat_bay(self, bay):
raise exc.UnsupportedFunctionality(
'Bay reseat not supported on this platform')

View File

@ -95,6 +95,16 @@ class OEMHandler(generic.OEMHandler):
self.updating = False
self.datacache = {}
def reseat_bay(self, bay):
if bay != -1:
raise pygexc.UnsupportedFunctionality(
'This is not an enclosure manager')
rsp = self.wc.grab_json_response_with_status(
'/api/providers/virt_reseat', '{}')
if rsp[1] != 200 or rsp[0].get('return', 1) != 0:
raise pygexc.UnsupportedFunctionality(
'This platform does not support AC reseat.')
def get_cached_data(self, attribute, age=30):
try:
kv = self.datacache[attribute]