2
0
mirror of https://opendev.org/x/pyghmi synced 2026-01-10 02:02:30 +00:00

Tolerate timeout on reseat

A server reseating itself will unplug itself potentially
before replying. Tolerate this and be optimistic and assume success.

Change-Id: Ic021cb539b59d1f6cf287033a1146151ced95eda
This commit is contained in:
Jarrod Johnson
2025-04-16 16:15:18 -04:00
parent 2bade4a2a7
commit 6ec04d585a
2 changed files with 11 additions and 4 deletions

View File

@@ -960,8 +960,11 @@ class XCCClient(IMMClient):
def reseat(self):
wc = self.wc.dupe(timeout=5)
rsp = wc.grab_json_response_with_status(
'/api/providers/virt_reseat', '{}')
try:
rsp = wc.grab_json_response_with_status(
'/api/providers/virt_reseat', '{}')
except socket.timeout:
return # probably reseated itself and unable to reply
if rsp[1] == 500 and rsp[0] == 'Target Unavailable':
return
if rsp[1] != 200 or rsp[0].get('return', 1) != 0:

View File

@@ -311,8 +311,12 @@ class OEMHandler(generic.OEMHandler):
raise pygexc.UnsupportedFunctionality(
'This is not an enclosure manager')
wc = self.wc.dupe(timeout=5)
rsp = wc.grab_json_response_with_status(
'/api/providers/virt_reseat', '{}')
try:
rsp = wc.grab_json_response_with_status(
'/api/providers/virt_reseat', '{}')
except socket.timeout:
# Can't be certain, but most likely a timeout'
return
if rsp[1] == 500 and rsp[0] == 'Target Unavailable':
return
if rsp[1] != 200 or rsp[0].get('return', 1) != 0: