Skip to contentSkip to conversation

Fix some quorum nits after merge

PATCH Superseded Benoît Canet 2 participants 6 messages Feb 21, 2014 – Feb 22, 2014 Block layer

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover Fix some quorum nits after merge

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(-)
Signature · 1 line
1.8.3.2
#1 lore raw

PATCH 1/3 qmp: Fix BlockdevOptionQuorum.

Fix some nits before QEMU 2.0 freeze.

---
 qapi-schema.json | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
qapi-schema.json +3 -2
index fcb22800..ab5cdde 100644
@@ -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
 ##
Signature · 1 line
1.8.3.2
Reviewed-by on v1 1/3
#2 lore raw

Re: [Qemu-devel] [PATCH 1/3] qmp: Fix BlockdevOptionQuorum.

Quoted 6 lines · Benoît Canet

Fix some nits before QEMU 2.0 freeze.

---
 qapi-schema.json | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
Quoted 20 lines
qapi-schema.json +3 -2
index fcb22800..ab5cdde 100644
@@ -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
 ##
Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
#3 lore raw

PATCH 2/3 qmp: Make Quorum error events more palatable.

In reply to Benoît Canet

Insert quorum QMP events documentation alphabetically.

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

---
 block/quorum.c             |  5 ++--
 docs/qmp/qmp-events.txt    | 72 +++++++++++++++++++++++-----------------------
 tests/qemu-iotests/081.out |  2 +-
 3 files changed, 40 insertions(+), 39 deletions(-)
block/quorum.c +3 -2
index 6c28239..3ef8eaa 100644
@@ -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);
 }
docs/qmp/qmp-events.txt +36 -36

81 lines not on this page · raw message

tests/qemu-iotests/081.out +1 -1
index 4fe2f95..62611e9 100644
@@ -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": ""}
Signature · 1 line
1.8.3.2
#4 lore raw

Re: [Qemu-devel] [PATCH 2/3] qmp: Make Quorum error events more palatable.

Quoted 17 lines · Benoît Canet

Insert quorum QMP events documentation alphabetically.

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

---
 block/quorum.c             |  5 ++--
 docs/qmp/qmp-events.txt    | 72 +++++++++++++++++++++++-----------------------
 tests/qemu-iotests/081.out |  2 +-
 3 files changed, 40 insertions(+), 39 deletions(-)
block/quorum.c +0 -0
index 6c28239..3ef8eaa 100644

block/quorum.c static void quorum_report_bad(QuorumAIOCB *acb, char *node_name, int ret) · line 207

Quoted 10 lines
block/quorum.c +2 -2
@@ -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...

block/quorum.c static void quorum_report_bad(QuorumAIOCB *acb, char *node_name, int ret) · line 209

Quoted 2 lines
block/quorum.c +2 -0
+{ "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')

Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
#5 lore raw

PATCH 3/3 qemu-io-test: Disable Quorum test when not compiled in.

In reply to Benoît Canet

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

---
 tests/qemu-iotests/081 | 3 +++
 1 file changed, 3 insertions(+)
tests/qemu-iotests/081 +3 -0
index f053f11..c1078f6 100755
@@ -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"
Signature · 1 line
1.8.3.2