diff --git a/pyghmi/redfish/command.py b/pyghmi/redfish/command.py index 6801720c..36489ec7 100644 --- a/pyghmi/redfish/command.py +++ b/pyghmi/redfish/command.py @@ -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'] diff --git a/pyghmi/redfish/oem/generic.py b/pyghmi/redfish/oem/generic.py index cbfacd5d..8a3ab72d 100644 --- a/pyghmi/redfish/oem/generic.py +++ b/pyghmi/redfish/oem/generic.py @@ -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') diff --git a/pyghmi/redfish/oem/lenovo/xcc.py b/pyghmi/redfish/oem/lenovo/xcc.py index 19be1e8d..c82b565e 100644 --- a/pyghmi/redfish/oem/lenovo/xcc.py +++ b/pyghmi/redfish/oem/lenovo/xcc.py @@ -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]