From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34258) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZMdWk-0003iQ-Bi for qemu-devel@nongnu.org; Tue, 04 Aug 2015 10:49:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZMdWe-000152-7X for qemu-devel@nongnu.org; Tue, 04 Aug 2015 10:49:14 -0400 Received: from e06smtp15.uk.ibm.com ([195.75.94.111]:33444) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZMdWd-00012g-Tt for qemu-devel@nongnu.org; Tue, 04 Aug 2015 10:49:08 -0400 Received: from /spool/local by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 4 Aug 2015 15:49:01 +0100 From: Sascha Silbe Date: Tue, 4 Aug 2015 16:48:25 +0200 Message-Id: <1438699705-21761-1-git-send-email-silbe@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH] block: don't register quorum driver if SHA256 support is unavailable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Alberto Garcia , qemu-block@nongnu.org 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 --- 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