From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38671) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YZyXz-0004bq-BY for qemu-devel@nongnu.org; Mon, 23 Mar 2015 05:21:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YZyXs-0007VE-Fj for qemu-devel@nongnu.org; Mon, 23 Mar 2015 05:21:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54916) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YZyXs-0007UQ-99 for qemu-devel@nongnu.org; Mon, 23 Mar 2015 05:21:16 -0400 From: Markus Armbruster References: <761b091f1fa10354f9594cf7a867cf6eb2701b1f.1426861657.git.berto@igalia.com> Date: Mon, 23 Mar 2015 10:20:31 +0100 In-Reply-To: <761b091f1fa10354f9594cf7a867cf6eb2701b1f.1426861657.git.berto@igalia.com> (Alberto Garcia's message of "Fri, 20 Mar 2015 16:33:55 +0200") Message-ID: <87egogt6hs.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH 3/3] block: add 'node-name' field to BLOCK_IMAGE_CORRUPTED List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alberto Garcia Cc: Kevin Wolf , qemu-devel@nongnu.org, Stefan Hajnoczi , Max Reitz Alberto Garcia writes: > Since this event can occur in nodes that cannot have a device name > associated, include also a field with the node name. > > Signed-off-by: Alberto Garcia > --- > block/qcow2.c | 8 ++++++-- > docs/qmp/qmp-events.txt | 16 +++++++++------- > qapi/block-core.json | 13 ++++++++----- > 3 files changed, 23 insertions(+), 14 deletions(-) > > diff --git a/block/qcow2.c b/block/qcow2.c > index 168006b..e7c78f1 100644 > --- a/block/qcow2.c > +++ b/block/qcow2.c > @@ -2809,6 +2809,7 @@ void qcow2_signal_corruption(BlockDriverState *bs, bool fatal, int64_t offset, > int64_t size, const char *message_format, ...) > { > BDRVQcowState *s = bs->opaque; > + const char *node_name; > char *message; > va_list ap; > > @@ -2832,8 +2833,11 @@ void qcow2_signal_corruption(BlockDriverState *bs, bool fatal, int64_t offset, > "corruption events will be suppressed\n", message); > } > > - qapi_event_send_block_image_corrupted(bdrv_get_device_name(bs), message, > - offset >= 0, offset, size >= 0, size, > + node_name = bdrv_get_node_name(bs); > + qapi_event_send_block_image_corrupted(bdrv_get_device_name(bs), > + *node_name != '\0', node_name, > + message, offset >= 0, offset, > + size >= 0, size, > fatal, &error_abort); > g_free(message); > > diff --git a/docs/qmp/qmp-events.txt b/docs/qmp/qmp-events.txt > index d759d19..ed1d0a5 100644 > --- a/docs/qmp/qmp-events.txt > +++ b/docs/qmp/qmp-events.txt > @@ -35,17 +35,19 @@ Emitted when a disk image is being marked corrupt. > > Data: > > -- "device": Device name (json-string) > -- "msg": Informative message (e.g., reason for the corruption) (json-string) > -- "offset": If the corruption resulted from an image access, this is the access > - offset into the image (json-int) > -- "size": If the corruption resulted from an image access, this is the access > - size (json-int) > +- "device": Device name (json-string) > +- "node-name": Node name, if it's present (json-string) By convention, we mark optional members like this: - "node-name": Node name (json-string, optional) Ignorant question: can "device" be ""? If yes, we should document what that means, possibly in a separate patch. > +- "msg": Informative message (e.g., reason for the corruption) > + (json-string) > +- "offset": If the corruption resulted from an image access, this > + is the access offset into the image (json-int) > +- "size": If the corruption resulted from an image access, this > + is the access size (json-int) > > Example: > > { "event": "BLOCK_IMAGE_CORRUPTED", > - "data": { "device": "ide0-hd0", > + "data": { "device": "ide0-hd0", "node-name": "node0", > "msg": "Prevented active L1 table overwrite", "offset": 196608, > "size": 65536 }, > "timestamp": { "seconds": 1378126126, "microseconds": 966463 } } > diff --git a/qapi/block-core.json b/qapi/block-core.json > index f525b04..2a40b73 100644 > --- a/qapi/block-core.json > +++ b/qapi/block-core.json > @@ -1752,6 +1752,8 @@ > # > # @device: device name > # > +# @node-name: #optional node name (Since: 2.4) > +# > # @msg: informative message for human consumption, such as the kind of > # corruption being detected. It should not be parsed by machine as it is > # not guaranteed to be stable > @@ -1769,11 +1771,12 @@ > # Since: 1.7 > ## > { 'event': 'BLOCK_IMAGE_CORRUPTED', > - 'data': { 'device' : 'str', > - 'msg' : 'str', > - '*offset': 'int', > - '*size' : 'int', > - 'fatal' : 'bool' } } > + 'data': { 'device' : 'str', > + '*node-name' : 'str', > + 'msg' : 'str', > + '*offset' : 'int', > + '*size' : 'int', > + 'fatal' : 'bool' } } > > ## > # @BLOCK_IO_ERROR