Skip to contentSkip to conversation

Fix some quorum nits after merge

PATCH Applied Benoît Canet 3 participants 6 messages Feb 22, 2014 – Feb 26, 2014 Block layer

lore
Share & tools
lore
#0 lore raw

v3 cover Fix some quorum nits after merge

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

PATCH v3 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
#2 lore raw

PATCH v3 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 an optional "error" being an strerror(-ret) in the QUORUM_REPORT_BAD qmp event.

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

84 lines not on this page · raw message

tests/qemu-iotests/081.out +1 -1
index 4fe2f95..84aeb0c 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}}
 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
#3 lore raw

PATCH v3 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..b512d00 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
#5 lore raw
In reply to Benoît Canet
Quoted 16 lines · Benoît Canet

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.

Quoted 6 lines
 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