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:
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user