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:
Jarrod Johnson 2023-07-27 15:59:17 -04:00
parent 9c84b8ad50
commit a7afc5b0e5
3 changed files with 12 additions and 4 deletions

View File

@ -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.')

View File

@ -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.')

View File

@ -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