2
0
mirror of https://opendev.org/x/pyghmi synced 2026-03-30 14:53:32 +00:00

Assign code to timeout behavior

While 'timeout' is not something defined in the IPMI spec
(it would make no sense), assign it an impossible value
so that calling code will experience timeout condition
as if it were a 'normal' ipmi error.

Change-Id: I8165497704148b79bc7996229f6f889b011e6d56
This commit is contained in:
Jarrod Johnon
2015-01-22 11:18:27 -05:00
parent c74b7ef0ee
commit f4590dad58
3 changed files with 3 additions and 2 deletions

View File

@@ -384,7 +384,7 @@ class Command(object):
if 'error' in rsp:
if rsp['code'] == 203: # Sensor does not exist, optional dev
continue
raise Exception(rsp['error'])
raise exc.IpmiException(rsp['error'], code=rsp['code'])
yield self._sdr.sensors[sensor].decode_sensor_reading(rsp['data'])
def get_sensor_descriptions(self):

View File

@@ -1174,4 +1174,5 @@ ipmi_completion_codes = {
0xd5: "Command not supported in present state",
0xd6: "Cannot execute command because subfunction disabled or unavailable",
0xff: "Unspecified",
0xffff: "Timeout", # not ipmi, but used internally
}

View File

@@ -1436,7 +1436,7 @@ class Session(object):
self.nowait = True
self.timeout += 1
if self.timeout > self.maxtimeout:
response = {'error': 'timeout'}
response = {'error': 'timeout', 'code': 0xffff}
self.ipmicallback(response)
self.nowait = False
self._mark_broken()