qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/3] Fix some quorum nits after merge
@ 2014-02-21 23:58 Benoît Canet
  2014-02-21 23:58 ` [Qemu-devel] [PATCH 1/3] qmp: Fix BlockdevOptionQuorum Benoît Canet
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Benoît Canet @ 2014-02-21 23:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, Benoît Canet, stefanha

Fix qemu-io test to ignore quorum when not compiled in [Kevin]
Fix quorum QMP event [Eric]
Fix QMP documentation [Eric]

Benoît Canet (3):
  qmp: Fix BlockdevOptionQuorum.
  qmp: Make Quorum error events more palatable.
  qemu-io-test: Disable Quorum test when not compiled in.

 block/quorum.c             |  5 ++--
 docs/qmp/qmp-events.txt    | 72 +++++++++++++++++++++++-----------------------
 qapi-schema.json           |  5 ++--
 tests/qemu-iotests/081     |  3 ++
 tests/qemu-iotests/081.out |  2 +-
 5 files changed, 46 insertions(+), 41 deletions(-)

-- 
1.8.3.2

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Qemu-devel] [PATCH 1/3] qmp: Fix BlockdevOptionQuorum.
  2014-02-21 23:58 [Qemu-devel] [PATCH 0/3] Fix some quorum nits after merge Benoît Canet
@ 2014-02-21 23:58 ` Benoît Canet
  2014-02-22  0:17   ` Eric Blake
  2014-02-21 23:58 ` [Qemu-devel] [PATCH 2/3] qmp: Make Quorum error events more palatable Benoît Canet
  2014-02-21 23:58 ` [Qemu-devel] [PATCH 3/3] qemu-io-test: Disable Quorum test when not compiled in Benoît Canet
  2 siblings, 1 reply; 6+ messages in thread
From: Benoît Canet @ 2014-02-21 23:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, Benoît Canet, Benoit Canet, stefanha

Fix some nits before QEMU 2.0 freeze.

Signed-off-by: Benoit Canet <benoit@irqsave.net>
---
 qapi-schema.json | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/qapi-schema.json b/qapi-schema.json
index fcb22800..ab5cdde 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -4437,10 +4437,11 @@
 # Driver specific block device options for Quorum
 #
 # @blkverify:      #optional true if the driver must print content mismatch
+#                  set to false by default
 #
-# @children:       the children block device to use
+# @children:       the children block devices to use
 #
-# @vote_threshold: the vote limit under which a read will fail
+# @vote-threshold: the vote limit under which a read will fail
 #
 # Since: 2.0
 ##
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Qemu-devel] [PATCH 2/3] qmp: Make Quorum error events more palatable.
  2014-02-21 23:58 [Qemu-devel] [PATCH 0/3] Fix some quorum nits after merge Benoît Canet
  2014-02-21 23:58 ` [Qemu-devel] [PATCH 1/3] qmp: Fix BlockdevOptionQuorum Benoît Canet
@ 2014-02-21 23:58 ` Benoît Canet
  2014-02-22  0:17   ` Eric Blake
  2014-02-21 23:58 ` [Qemu-devel] [PATCH 3/3] qemu-io-test: Disable Quorum test when not compiled in Benoît Canet
  2 siblings, 1 reply; 6+ messages in thread
From: Benoît Canet @ 2014-02-21 23:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, Benoît Canet, Benoit Canet, stefanha

Insert quorum QMP events documentation alphabetically.

Also change the "ret" errno value by "error" being an strerror() in the
QUORUM_REPORT_BAD qmp event.

Signed-off-by: Benoit Canet <benoit@irqsave.net>
---
 block/quorum.c             |  5 ++--
 docs/qmp/qmp-events.txt    | 72 +++++++++++++++++++++++-----------------------
 tests/qemu-iotests/081.out |  2 +-
 3 files changed, 40 insertions(+), 39 deletions(-)

diff --git a/block/quorum.c b/block/quorum.c
index 6c28239..3ef8eaa 100644
--- a/block/quorum.c
+++ b/block/quorum.c
@@ -200,11 +200,12 @@ static void quorum_report_bad(QuorumAIOCB *acb, char *node_name, int ret)
 {
     QObject *data;
     assert(node_name);
-    data = qobject_from_jsonf("{ 'ret': %d"
+    data = qobject_from_jsonf("{ 'error': %s"
                               ", 'node-name': %s"
                               ", 'sector-num': %" PRId64
                               ", 'sectors-count': %d }",
-                              ret, node_name, acb->sector_num, acb->nb_sectors);
+                              strerror(ret), node_name, acb->sector_num,
+                              acb->nb_sectors);
     monitor_protocol_event(QEVENT_QUORUM_REPORT_BAD, data);
     qobject_decref(data);
 }
diff --git a/docs/qmp/qmp-events.txt b/docs/qmp/qmp-events.txt
index 00f9515..2223220 100644
--- a/docs/qmp/qmp-events.txt
+++ b/docs/qmp/qmp-events.txt
@@ -225,6 +225,42 @@ Data:
   "timestamp": { "seconds": 1368697518, "microseconds": 326866 } }
 }
 
+QUORUM_FAILURE
+--------------
+
+Emitted by the Quorum block driver if it fails to establish a quorum.
+
+Data:
+
+- "reference":    device name if defined else node name.
+- "sector-num":   Number of the first sector of the failed read operation.
+- "sector-count": Failed read operation sector count.
+
+Example:
+
+{ "event": "QUORUM_FAILURE",
+     "data": { "reference": "usr1", "sector-num": 345435, "sector-count": 5 },
+     "timestamp": { "seconds": 1344522075, "microseconds": 745528 } }
+
+QUORUM_REPORT_BAD
+-----------------
+
+Emitted to report a corruption of a Quorum file.
+
+Data:
+
+- "error":        Human only strerror() string
+- "node-name":    The graph node name of the block driver state.
+- "sector-num":   Number of the first sector of the failed read operation.
+- "sector-count": Failed read operation sector count.
+
+Example:
+
+{ "event": "QUORUM_REPORT_BAD",
+     "data": { "error": "Success", "node-name": "1.raw", "sector-num": 345435,
+               "sector-count": 5 },
+     "timestamp": { "seconds": 1344522075, "microseconds": 745528 } }
+
 RESET
 -----
 
@@ -500,39 +536,3 @@ Example:
 
 Note: If action is "reset", "shutdown", or "pause" the WATCHDOG event is
 followed respectively by the RESET, SHUTDOWN, or STOP events.
-
-QUORUM_FAILURE
---------------
-
-Emitted by the Quorum block driver if it fails to establish a quorum.
-
-Data:
-
-- "reference":    device name if defined else node name.
-- "sector-num":   Number of the first sector of the failed read operation.
-- "sector-count": Failed read operation sector count.
-
-Example:
-
-{ "event": "QUORUM_FAILURE",
-     "data": { "reference": "usr1", "sector-num": 345435, "sector-count": 5 },
-     "timestamp": { "seconds": 1344522075, "microseconds": 745528 } }
-
-QUORUM_REPORT_BAD
------------------
-
-Emitted to report a corruption of a Quorum file.
-
-Data:
-
-- "ret":          The IO return code.
-- "node-name":    The graph node name of the block driver state.
-- "sector-num":   Number of the first sector of the failed read operation.
-- "sector-count": Failed read operation sector count.
-
-Example:
-
-{ "event": "QUORUM_REPORT_BAD",
-     "data": { "ret": 0, "node-name": "1.raw", "sector-num": 345435,
-               "sector-count": 5 },
-     "timestamp": { "seconds": 1344522075, "microseconds": 745528 } }
diff --git a/tests/qemu-iotests/081.out b/tests/qemu-iotests/081.out
index 4fe2f95..62611e9 100644
--- a/tests/qemu-iotests/081.out
+++ b/tests/qemu-iotests/081.out
@@ -30,7 +30,7 @@ Testing: -drive file=TEST_DIR/2.IMGFMT,format=IMGFMT,if=none,id=drive2
 QMP_VERSION
 {"return": {}}
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "QUORUM_REPORT_BAD", "data": {"node-name": "", "ret": 0, "sectors-count": 20480, "sector-num": 0}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "QUORUM_REPORT_BAD", "data": {"node-name": "", "sectors-count": 20480, "sector-num": 0, "error": "Success"}}
 read 10485760/10485760 bytes at offset 0
 10 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 {"return": ""}
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Qemu-devel] [PATCH 3/3] qemu-io-test: Disable Quorum test when not compiled in.
  2014-02-21 23:58 [Qemu-devel] [PATCH 0/3] Fix some quorum nits after merge Benoît Canet
  2014-02-21 23:58 ` [Qemu-devel] [PATCH 1/3] qmp: Fix BlockdevOptionQuorum Benoît Canet
  2014-02-21 23:58 ` [Qemu-devel] [PATCH 2/3] qmp: Make Quorum error events more palatable Benoît Canet
@ 2014-02-21 23:58 ` Benoît Canet
  2 siblings, 0 replies; 6+ messages in thread
From: Benoît Canet @ 2014-02-21 23:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, Benoît Canet, Benoit Canet, stefanha

Quorum is not compiled by default: make the quorum 081 test aware of this.

Signed-off-by: Benoit Canet <benoit@irqsave.net>
---
 tests/qemu-iotests/081 | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tests/qemu-iotests/081 b/tests/qemu-iotests/081
index f053f11..c1078f6 100755
--- a/tests/qemu-iotests/081
+++ b/tests/qemu-iotests/081
@@ -56,6 +56,9 @@ function run_qemu()
     do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qmp | _filter_qemu_io
 }
 
+test_quorum=$(qemu-img --help|grep quorum)
+[ "$test_quorum" = "" ] && _supported_fmt quorum
+
 quorum="file.driver=quorum,file.children.0.file.filename=$TEST_DIR/1.raw"
 quorum="$quorum,file.children.1.file.filename=$TEST_DIR/2.raw"
 quorum="$quorum,file.children.2.file.filename=$TEST_DIR/3.raw,file.vote-threshold=2"
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH 2/3] qmp: Make Quorum error events more palatable.
  2014-02-21 23:58 ` [Qemu-devel] [PATCH 2/3] qmp: Make Quorum error events more palatable Benoît Canet
@ 2014-02-22  0:17   ` Eric Blake
  0 siblings, 0 replies; 6+ messages in thread
From: Eric Blake @ 2014-02-22  0:17 UTC (permalink / raw)
  To: Benoît Canet, qemu-devel; +Cc: kwolf, Benoit Canet, stefanha

[-- Attachment #1: Type: text/plain, Size: 2319 bytes --]

On 02/21/2014 04:58 PM, Benoît Canet wrote:
> Insert quorum QMP events documentation alphabetically.
> 
> Also change the "ret" errno value by "error" being an strerror() in the
> QUORUM_REPORT_BAD qmp event.
> 
> Signed-off-by: Benoit Canet <benoit@irqsave.net>
> ---
>  block/quorum.c             |  5 ++--
>  docs/qmp/qmp-events.txt    | 72 +++++++++++++++++++++++-----------------------
>  tests/qemu-iotests/081.out |  2 +-
>  3 files changed, 40 insertions(+), 39 deletions(-)
> 
> diff --git a/block/quorum.c b/block/quorum.c
> index 6c28239..3ef8eaa 100644
> --- a/block/quorum.c
> +++ b/block/quorum.c
> @@ -200,11 +200,12 @@ static void quorum_report_bad(QuorumAIOCB *acb, char *node_name, int ret)
>  {
>      QObject *data;
>      assert(node_name);
> -    data = qobject_from_jsonf("{ 'ret': %d"
> +    data = qobject_from_jsonf("{ 'error': %s"
>                                ", 'node-name': %s"
>                                ", 'sector-num': %" PRId64
>                                ", 'sectors-count': %d }",
> -                              ret, node_name, acb->sector_num, acb->nb_sectors);
> +                              strerror(ret), node_name, acb->sector_num,

Is ret positive or negative?  Our typical convention is to use -errno
values for return (since we prefer reporting errors as less than 0),
which may mean needing strerror(-ret) here.

Also, I'd suggest making 'error' optional, and only omit it when ret is
non-zero.  Otherwise...

> +{ "event": "QUORUM_REPORT_BAD",
> +     "data": { "error": "Success", "node-name": "1.raw", "sector-num": 345435,

we get these weird-looking "error": "Success" strings.  Look at how
BLOCK_JOB_COMPLETED documents things - I'd just lift that full paragraph:

- "error":    Error message (json-string, optional)
              Only present on failure.  This field contains a human-readable
              error message.  There are no semantics other than that
streaming
              has failed and clients should not try to interpret the error
              string.

(When we eventually add events into qapi-schema.json as a first-class
citizen, it will be listed as '*error':'str')

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH 1/3] qmp: Fix BlockdevOptionQuorum.
  2014-02-21 23:58 ` [Qemu-devel] [PATCH 1/3] qmp: Fix BlockdevOptionQuorum Benoît Canet
@ 2014-02-22  0:17   ` Eric Blake
  0 siblings, 0 replies; 6+ messages in thread
From: Eric Blake @ 2014-02-22  0:17 UTC (permalink / raw)
  To: Benoît Canet, qemu-devel; +Cc: kwolf, Benoit Canet, stefanha

[-- Attachment #1: Type: text/plain, Size: 1042 bytes --]

On 02/21/2014 04:58 PM, Benoît Canet wrote:
> Fix some nits before QEMU 2.0 freeze.
> 
> Signed-off-by: Benoit Canet <benoit@irqsave.net>
> ---
>  qapi-schema.json | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

Reviewed-by: Eric Blake <eblake@redhat.com>

> 
> diff --git a/qapi-schema.json b/qapi-schema.json
> index fcb22800..ab5cdde 100644
> --- a/qapi-schema.json
> +++ b/qapi-schema.json
> @@ -4437,10 +4437,11 @@
>  # Driver specific block device options for Quorum
>  #
>  # @blkverify:      #optional true if the driver must print content mismatch
> +#                  set to false by default
>  #
> -# @children:       the children block device to use
> +# @children:       the children block devices to use
>  #
> -# @vote_threshold: the vote limit under which a read will fail
> +# @vote-threshold: the vote limit under which a read will fail
>  #
>  # Since: 2.0
>  ##
> 

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-02-22  0:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-21 23:58 [Qemu-devel] [PATCH 0/3] Fix some quorum nits after merge Benoît Canet
2014-02-21 23:58 ` [Qemu-devel] [PATCH 1/3] qmp: Fix BlockdevOptionQuorum Benoît Canet
2014-02-22  0:17   ` Eric Blake
2014-02-21 23:58 ` [Qemu-devel] [PATCH 2/3] qmp: Make Quorum error events more palatable Benoît Canet
2014-02-22  0:17   ` Eric Blake
2014-02-21 23:58 ` [Qemu-devel] [PATCH 3/3] qemu-io-test: Disable Quorum test when not compiled in Benoît Canet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).