diff --git a/pyghmi/ipmi/oem/lenovo/imm.py b/pyghmi/ipmi/oem/lenovo/imm.py index 4a8ff010..f718cf38 100644 --- a/pyghmi/ipmi/oem/lenovo/imm.py +++ b/pyghmi/ipmi/oem/lenovo/imm.py @@ -939,8 +939,11 @@ class XCCClient(IMMClient): {'RoleId': role}, method='PATCH') def reseat(self): - rsp = self.wc.grab_json_response_with_status( + wc = self.wc.dupe(timeout=5) + rsp = wc.grab_json_response_with_status( '/api/providers/virt_reseat', '{}') + if rsp[1] == 500 and rsp[0] == 'Target Unavailable': + return if rsp[1] != 200 or rsp[0].get('return', 1) != 0: raise pygexc.UnsupportedFunctionality( 'This platform does not support AC reseat.') diff --git a/pyghmi/redfish/oem/lenovo/xcc.py b/pyghmi/redfish/oem/lenovo/xcc.py index ffdc92c3..322fcf9a 100644 --- a/pyghmi/redfish/oem/lenovo/xcc.py +++ b/pyghmi/redfish/oem/lenovo/xcc.py @@ -268,8 +268,11 @@ class OEMHandler(generic.OEMHandler): if bay != -1: raise pygexc.UnsupportedFunctionality( 'This is not an enclosure manager') - rsp = self.wc.grab_json_response_with_status( + wc = self.wc.dupe(timeout=5) + rsp = wc.grab_json_response_with_status( '/api/providers/virt_reseat', '{}') + if rsp[1] == 500 and rsp[0] == 'Target Unavailable': + return if rsp[1] != 200 or rsp[0].get('return', 1) != 0: raise pygexc.UnsupportedFunctionality( 'This platform does not support AC reseat.') diff --git a/pyghmi/util/webclient.py b/pyghmi/util/webclient.py index e6a3bb7d..f0b97a2e 100644 --- a/pyghmi/util/webclient.py +++ b/pyghmi/util/webclient.py @@ -160,9 +160,11 @@ class SecureHTTPConnection(httplib.HTTPConnection, object): self.sock.close() self.sock = None - def dupe(self): + def dupe(self, timeout=None): + if timeout is None: + timeout = self.mytimeout return SecureHTTPConnection(self.thehost, self.theport, clone=self, - timeout=self.mytimeout) + timeout=timeout) def set_header(self, key, value): self.stdheaders[key] = value