Commit e94867ed authored by Sascha Silbe's avatar Sascha Silbe Committed by Peter Maydell
Browse files

block: don't register quorum driver if SHA256 support is unavailable



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: 488981a4
Signed-off-by: default avatarSascha Silbe <silbe@linux.vnet.ibm.com>
Reviewed-by: default avatarEric Blake <eblake@redhat.com>
Reviewed-by: default avatarDaniel P. Berrange <berrange@redhat.com>
Reviewed-by: default avatarAlberto Garcia <berto@igalia.com>
Message-id: 1438699705-21761-1-git-send-email-silbe@linux.vnet.ibm.com
Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
parent 2be4f242
Loading
Loading
Loading
Loading
+4 −6
Original line number Diff line number Diff line
@@ -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);
}