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

in v3:
    use $QEMU_IMG (Fam)
    apply Eric reviewed by

in v2:

    make error optional and return strerror(-ret) [Eric]
    better documentation of the error string [Eric]
    apply Eric reviewed by


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             |  9 ++++--
 docs/qmp/qmp-events.txt    | 75 ++++++++++++++++++++++++----------------------
 qapi-schema.json           |  5 ++--
 tests/qemu-iotests/081     |  3 ++
 tests/qemu-iotests/081.out |  2 +-
 5 files changed, 52 insertions(+), 42 deletions(-)

-- 
1.8.3.2

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

* [Qemu-devel] [PATCH V3 1/3] qmp: Fix BlockdevOptionQuorum.
  2014-02-22 17:43 [Qemu-devel] [PATCH V3 0/3] Fix some quorum nits after merge Benoît Canet
@ 2014-02-22 17:43 ` Benoît Canet
  2014-02-22 17:43 ` [Qemu-devel] [PATCH V3 2/3] qmp: Make Quorum error events more palatable Benoît Canet
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Benoît Canet @ 2014-02-22 17:43 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, Benoît Canet, famz, Benoit Canet, mreitz, stefanha

Fix some nits before QEMU 2.0 freeze.

Signed-off-by: Benoit Canet <benoit@irqsave.net>
Reviewed-by: Eric Blake <eblake@redhat.com>
---
 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 V3 2/3] qmp: Make Quorum error events more palatable.
  2014-02-22 17:43 [Qemu-devel] [PATCH V3 0/3] Fix some quorum nits after merge Benoît Canet
  2014-02-22 17:43 ` [Qemu-devel] [PATCH V3 1/3] qmp: Fix BlockdevOptionQuorum Benoît Canet
@ 2014-02-22 17:43 ` Benoît Canet
  2014-02-22 17:43 ` [Qemu-devel] [PATCH V3 3/3] qemu-io-test: Disable Quorum test when not compiled in Benoît Canet
  2014-02-26 15:20 ` [Qemu-devel] [PATCH V3 0/3] Fix some quorum nits after merge Stefan Hajnoczi
  3 siblings, 0 replies; 6+ messages in thread
From: Benoît Canet @ 2014-02-22 17:43 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, Benoît Canet, famz, Benoit Canet, mreitz, stefanha

Insert quorum QMP events documentation alphabetically.

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

Signed-off-by: Benoit Canet <benoit@irqsave.net>
Reviewed-by: Eric Blake <eblake@redhat.com>
---
 block/quorum.c             |  9 ++++--
 docs/qmp/qmp-events.txt    | 75 ++++++++++++++++++++++++----------------------
 tests/qemu-iotests/081.out |  2 +-
 3 files changed, 46 insertions(+), 40 deletions(-)

diff --git a/block/quorum.c b/block/quorum.c
index 6c28239..bd997b7 100644
--- a/block/quorum.c
+++ b/block/quorum.c
@@ -200,11 +200,14 @@ static void quorum_report_bad(QuorumAIOCB *acb, char *node_name, int ret)
 {
     QObject *data;
     assert(node_name);
-    data = qobject_from_jsonf("{ 'ret': %d"
-                              ", 'node-name': %s"
+    data = qobject_from_jsonf("{ 'node-name': %s"
                               ", 'sector-num': %" PRId64
                               ", 'sectors-count': %d }",
-                              ret, node_name, acb->sector_num, acb->nb_sectors);
+                              node_name, acb->sector_num, acb->nb_sectors);
+    if (ret < 0) {
+        QDict *dict = qobject_to_qdict(data);
+        qdict_put(dict, "error", qstring_from_str(strerror(-ret)));
+    }
     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..145402e 100644
--- a/docs/qmp/qmp-events.txt
+++ b/docs/qmp/qmp-events.txt
@@ -225,6 +225,45 @@ 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":        Error message (json-string, optional)
+                  Only present on failure.  This field contains a human-readable
+                  error message.  There are no semantics other than that the
+                  block layer reported an error and clients should not try to
+                  interpret the error 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": { "node-name": "1.raw", "sector-num": 345435, "sector-count": 5 },
+     "timestamp": { "seconds": 1344522075, "microseconds": 745528 } }
+
 RESET
 -----
 
@@ -500,39 +539,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..84aeb0c 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}}
 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 V3 3/3] qemu-io-test: Disable Quorum test when not compiled in.
  2014-02-22 17:43 [Qemu-devel] [PATCH V3 0/3] Fix some quorum nits after merge Benoît Canet
  2014-02-22 17:43 ` [Qemu-devel] [PATCH V3 1/3] qmp: Fix BlockdevOptionQuorum Benoît Canet
  2014-02-22 17:43 ` [Qemu-devel] [PATCH V3 2/3] qmp: Make Quorum error events more palatable Benoît Canet
@ 2014-02-22 17:43 ` Benoît Canet
  2014-02-24  2:35   ` Fam Zheng
  2014-02-26 15:20 ` [Qemu-devel] [PATCH V3 0/3] Fix some quorum nits after merge Stefan Hajnoczi
  3 siblings, 1 reply; 6+ messages in thread
From: Benoît Canet @ 2014-02-22 17:43 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, Benoît Canet, famz, Benoit Canet, mreitz, 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..b512d00 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 V3 3/3] qemu-io-test: Disable Quorum test when not compiled in.
  2014-02-22 17:43 ` [Qemu-devel] [PATCH V3 3/3] qemu-io-test: Disable Quorum test when not compiled in Benoît Canet
@ 2014-02-24  2:35   ` Fam Zheng
  0 siblings, 0 replies; 6+ messages in thread
From: Fam Zheng @ 2014-02-24  2:35 UTC (permalink / raw)
  To: Benoît Canet; +Cc: kwolf, Benoit Canet, qemu-devel, mreitz, stefanha

On Sat, 02/22 18:43, Benoît Canet wrote:
> Quorum is not compiled by default: make the quorum 081 test aware of this.
> 
> Signed-off-by: Benoit Canet <benoit@irqsave.net>
Reviewed-by: Fam Zheng <famz@redhat.com>

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

* Re: [Qemu-devel] [PATCH V3 0/3] Fix some quorum nits after merge
  2014-02-22 17:43 [Qemu-devel] [PATCH V3 0/3] Fix some quorum nits after merge Benoît Canet
                   ` (2 preceding siblings ...)
  2014-02-22 17:43 ` [Qemu-devel] [PATCH V3 3/3] qemu-io-test: Disable Quorum test when not compiled in Benoît Canet
@ 2014-02-26 15:20 ` Stefan Hajnoczi
  3 siblings, 0 replies; 6+ messages in thread
From: Stefan Hajnoczi @ 2014-02-26 15:20 UTC (permalink / raw)
  To: Benoît Canet; +Cc: kwolf, famz, qemu-devel, stefanha, mreitz

On Sat, Feb 22, 2014 at 06:43:39PM +0100, Benoît Canet wrote:
> in v3:
>     use $QEMU_IMG (Fam)
>     apply Eric reviewed by
> 
> in v2:
> 
>     make error optional and return strerror(-ret) [Eric]
>     better documentation of the error string [Eric]
>     apply Eric reviewed by
> 
> 
> 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             |  9 ++++--
>  docs/qmp/qmp-events.txt    | 75 ++++++++++++++++++++++++----------------------
>  qapi-schema.json           |  5 ++--
>  tests/qemu-iotests/081     |  3 ++
>  tests/qemu-iotests/081.out |  2 +-
>  5 files changed, 52 insertions(+), 42 deletions(-)

Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block

Stefan

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

end of thread, other threads:[~2014-02-26 15:20 UTC | newest]

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

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).