qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] block: don't register quorum driver if SHA256 support is unavailable
@ 2015-08-04 14:48 Sascha Silbe
  2015-08-04 16:31 ` [Qemu-devel] [PATCH for-2.4] " Eric Blake
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Sascha Silbe @ 2015-08-04 14:48 UTC (permalink / raw)
  To: qemu-devel; +Cc: Kevin Wolf, Alberto Garcia, qemu-block

Commit 488981a4 [block: convert quorum blockdrv to use crypto APIs]
broke qemu-iotest 041 on hosts with GnuTLS < 2.10.0. It converted a
compile-time check to a run-time check at device open time. The result
is that we now advertise a feature (the quorum block driver) that will
never work (on those hosts). There's no way (short of parsing
human-readable error messages) for qemu-iotests or any other API
consumer to recognise that the quorum block driver isn't _actually_
available and shouldn't be used or tested.

Move the run-time check to bdrv_quorum_init() to avoid registering the
quorum block driver if we know it cannot work. This way API consumers
can recognise it's unavailable.

Fixes: 488981a4af396551a3178d032cc2b41d9553ada2
Signed-off-by: Sascha Silbe <silbe@linux.vnet.ibm.com>
---
 block/quorum.c |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/block/quorum.c b/block/quorum.c
index 4e66221..2f6c45f 100644
--- a/block/quorum.c
+++ b/block/quorum.c
@@ -865,12 +865,6 @@ static int quorum_open(BlockDriverState *bs, QDict *options, int flags,
     int i;
     int ret = 0;
 
-    if (!qcrypto_hash_supports(QCRYPTO_HASH_ALG_SHA256)) {
-        error_setg(errp,
-                   "SHA256 hash support is required for quorum device");
-        return -EINVAL;
-    }
-
     qdict_flatten(options);
 
     /* count how many different children are present */
@@ -1061,6 +1055,10 @@ static BlockDriver bdrv_quorum = {
 
 static void bdrv_quorum_init(void)
 {
+    if (!qcrypto_hash_supports(QCRYPTO_HASH_ALG_SHA256)) {
+        /* SHA256 hash support is required for quorum device */
+        return;
+    }
     bdrv_register(&bdrv_quorum);
 }
 
-- 
1.7.1

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

end of thread, other threads:[~2015-08-05 19:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-04 14:48 [Qemu-devel] [PATCH] block: don't register quorum driver if SHA256 support is unavailable Sascha Silbe
2015-08-04 16:31 ` [Qemu-devel] [PATCH for-2.4] " Eric Blake
2015-08-05  9:03 ` [Qemu-devel] [PATCH] " Alberto Garcia
2015-08-05  9:06 ` Daniel P. Berrange
2015-08-05 14:28 ` Peter Maydell
2015-08-05 19:04   ` Sascha Silbe

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