All of lore.kernel.org
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: Alberto Garcia <berto@igalia.com>, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
	Markus Armbruster <armbru@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 3/3] block: add 'node-name' field to BLOCK_IMAGE_CORRUPTED
Date: Fri, 20 Mar 2015 09:24:28 -0400	[thread overview]
Message-ID: <550C1F8C.60508@redhat.com> (raw)
In-Reply-To: <932200ac81ec4a55a176a14d12a0b9ca320e51e9.1426846535.git.berto@igalia.com>

On 2015-03-20 at 06:19, Alberto Garcia wrote:
> 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 <berto@igalia.com>
> ---
>   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)
> +- "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 42c8850..e650168 100644
> --- a/qapi/block-core.json
> +++ b/qapi/block-core.json
> @@ -1753,6 +1753,8 @@
>   #
>   # @device: device name
>   #
> +# @node-name: #optional node name (Since: 2.3)

*2.4

With that fixed:

Reviewed-by: Max Reitz <mreitz@redhat.com>

> +#
>   # @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
> @@ -1770,11 +1772,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

  reply	other threads:[~2015-03-20 13:25 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-20 10:19 [Qemu-devel] [PATCH v2 0/3] Add bdrv_get_device_or_node_name() Alberto Garcia
2015-03-20 10:19 ` [Qemu-devel] [PATCH 1/3] block: add bdrv_get_device_or_node_name() Alberto Garcia
2015-03-20 13:04   ` Max Reitz
2015-03-20 10:19 ` [Qemu-devel] [PATCH 2/3] block: use bdrv_get_device_or_node_name() in error messages Alberto Garcia
2015-03-20 13:22   ` Max Reitz
2015-03-20 13:57     ` Markus Armbruster
2015-03-20 10:19 ` [Qemu-devel] [PATCH 3/3] block: add 'node-name' field to BLOCK_IMAGE_CORRUPTED Alberto Garcia
2015-03-20 13:24   ` Max Reitz [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-03-20 14:33 [Qemu-devel] [PATCH v3 0/3] Add bdrv_get_device_or_node_name() Alberto Garcia
2015-03-20 14:33 ` [Qemu-devel] [PATCH 3/3] block: add 'node-name' field to BLOCK_IMAGE_CORRUPTED Alberto Garcia
2015-03-20 19:26   ` Max Reitz
2015-03-23  9:20   ` Markus Armbruster
2015-03-23  9:53     ` Alberto Garcia
2015-03-23 11:55       ` Markus Armbruster
2015-04-08  9:29 [Qemu-devel] [PATCH v4 0/3] Add bdrv_get_device_or_node_name() Alberto Garcia
2015-04-08  9:29 ` [Qemu-devel] [PATCH 3/3] block: add 'node-name' field to BLOCK_IMAGE_CORRUPTED Alberto Garcia
2015-04-08 23:32   ` Eric Blake
2015-04-09  7:30     ` Alberto Garcia
2015-04-15 13:24   ` Max Reitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=550C1F8C.60508@redhat.com \
    --to=mreitz@redhat.com \
    --cc=armbru@redhat.com \
    --cc=berto@igalia.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.