mirror of
https://opendev.org/x/pyghmi
synced 2025-04-12 16:27:42 +00:00
Expect timeout on reseat
When doing a reseat, the target will tend to unplug itself before a reply. In such a scenario, be optimistic about the result. Change-Id: Iae3aac15b48990e04dacabf94dd9149e9c0c1387
This commit is contained in:
parent
9c84b8ad50
commit
a7afc5b0e5
@ -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.')
|
||||
|
@ -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.')
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user