On 12/21/2017 06:11 PM, Jack Schwartz wrote:
BLOCK_IO_ERROR events currently contain a "reason" string which is strerror(errno) of the error. This enhancement provides those events with the numeric errno value as well, since it is easier to parse for error type than a string.
NACK. Numeric errno values are platform-dependent, but QMP must be platform-independent. If you want to expose errno NAMES (not values), then create a QAPI enum and add the enum to the error structure (so that you are still passing names, not int values, over the wire).
+++ b/qapi/block-core.json @@ -3660,6 +3660,11 @@ # io-status is present, please see query-block documentation # for more information (since: 2.2) # +# @errno: int describing the error cause, provided for applications. +# (Note: while most errnos are posix compliant between OSs, it +# is possible some errno values can vary among different OSs.) +# (since 2.12)
The proof is in the pudding - if your documentation has to give this big disclaimer, then what you are adding is not portable and should not be added in that manner.
+# # @reason: human readable string describing the error cause. # (This field is a debugging aid for humans, it should not # be parsed by applications) (since: 2.2) @@ -3675,14 +3680,17 @@ # "data": { "device": "ide0-hd1", # "node-name": "#block212", # "operation": "write", -# "action": "stop" }, +# "action": "stop", +# "nospace": false, +# "errno": 5,
So this should be "errno":"ENOSPC", not 5.
+# "reason": "Input/output error" }, # "timestamp": { "seconds": 1265044230, "microseconds": 450486 } } # ## { 'event': 'BLOCK_IO_ERROR', 'data': { 'device': 'str', 'node-name': 'str', 'operation': 'IoOperationType', 'action': 'BlockErrorAction', '*nospace': 'bool', - 'reason': 'str' } } + 'errno': 'int', 'reason': 'str' } }
and this should be the name of a QAPI enum type, not 'int'. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org