From patchwork Thu Oct 18 08:59:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alberto Garcia X-Patchwork-Id: 10646875 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BEF11109C for ; Thu, 18 Oct 2018 09:01:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A825828867 for ; Thu, 18 Oct 2018 09:01:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9BA9528870; Thu, 18 Oct 2018 09:01:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id EF5F928867 for ; Thu, 18 Oct 2018 09:01:10 +0000 (UTC) Received: from localhost ([::1]:41157 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gD4B4-0001zV-98 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 18 Oct 2018 05:01:10 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33337) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gD49c-00010q-0Z for qemu-devel@nongnu.org; Thu, 18 Oct 2018 04:59:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gD49Z-0008H2-84 for qemu-devel@nongnu.org; Thu, 18 Oct 2018 04:59:39 -0400 Received: from fanzine.igalia.com ([91.117.99.155]:55298) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gD49Y-0007ju-FF; Thu, 18 Oct 2018 04:59:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=References:In-Reply-To:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=mShf7+2d/ko57IgWNWQPlxz/InbuFbMg8r+L+fuUBYM=; b=CRmg2LOFTOATwJEanICard54fwPiT60hF2CVMkQs9kqvXuS5Unu06Mt3mtgkQ2igYR9AuTnZbx2rVHSLquDFnRmnKSLPUuN2dMtWwSnhoZm0YxAMWQhfScGaUhBMNHB/RC07xjTvys5aag3FNIQD3As4gDeP85euIPzvtMC/fwte9vokUVEuHuBLZHlBrXlvUxjtWw0Hgw+FV0mFaYZlwUinD/YIk1Fwa/nfOoLu6sXe6o1gx9NMrHwkmgoIfvdQRmaoEhubdo+wr3SeX5fEENy0laHgGLr1aMITza69UEkNzonIgcr6GyTwrrMMAmVt+KbxAmwQmJ/zpVKJs0fOJQ==; Received: from [194.100.51.2] (helo=perseus.local) by fanzine.igalia.com with esmtpsa (Cipher TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim) id 1gD49O-0002eA-KH; Thu, 18 Oct 2018 10:59:26 +0200 Received: from berto by perseus.local with local (Exim 4.89) (envelope-from ) id 1gD495-00046b-9h; Thu, 18 Oct 2018 11:59:07 +0300 From: Alberto Garcia To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 11:59:03 +0300 Message-Id: X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy] X-Received-From: 91.117.99.155 Subject: [Qemu-devel] [PATCH 1/2] quorum: Forbid adding children in blkverify mode X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Alberto Garcia , qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The blkverify mode of Quorum only works when the number of children is exactly two, so any attempt to add a new one must return an error. quorum_del_child() on the other hand doesn't need any additional check because decreasing the number of children would make it go under the vote threshold. Signed-off-by: Alberto Garcia Reported-by: Kevin Wolf --- block/quorum.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/block/quorum.c b/block/quorum.c index 6188ff6666..16b3c8067c 100644 --- a/block/quorum.c +++ b/block/quorum.c @@ -992,6 +992,11 @@ static void quorum_add_child(BlockDriverState *bs, BlockDriverState *child_bs, char indexstr[32]; int ret; + if (s->is_blkverify) { + error_setg(errp, "Cannot add a child to a quorum in blkverify mode"); + return; + } + assert(s->num_children <= INT_MAX / sizeof(BdrvChild *)); if (s->num_children == INT_MAX / sizeof(BdrvChild *) || s->next_child_index == UINT_MAX) { @@ -1046,6 +1051,9 @@ static void quorum_del_child(BlockDriverState *bs, BdrvChild *child, return; } + /* We know now that num_children > threshold, so blkverify must be false */ + assert(!s->is_blkverify); + bdrv_drained_begin(bs); /* We can safely remove this child now */ From patchwork Thu Oct 18 08:59:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alberto Garcia X-Patchwork-Id: 10646877 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1CF15157A for ; Thu, 18 Oct 2018 09:01:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0F7AB28862 for ; Thu, 18 Oct 2018 09:01:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 034BE28869; Thu, 18 Oct 2018 09:01:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E52F228862 for ; Thu, 18 Oct 2018 09:01:10 +0000 (UTC) Received: from localhost ([::1]:41156 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gD4B3-0001zA-Ph for patchwork-qemu-devel@patchwork.kernel.org; Thu, 18 Oct 2018 05:01:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33338) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gD49c-00010r-0p for qemu-devel@nongnu.org; Thu, 18 Oct 2018 04:59:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gD49Y-0008DQ-Es for qemu-devel@nongnu.org; Thu, 18 Oct 2018 04:59:39 -0400 Received: from fanzine.igalia.com ([91.117.99.155]:55296) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gD49U-0007jj-IT; Thu, 18 Oct 2018 04:59:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=References:In-Reply-To:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=Y/DuBY1ANCcKjZynltmx4kyk6CnpLbHq+T8a2gLIOIY=; b=XZ59+kGXKHD3ZyLFOPPVqbqqp/l7RK7/1CCjVYMs6R+a9crN9863oiQgIO+fi6nB6pGUAExhPtLoqUsmzNLFMdal82/V9vuiQ2CW2cPDVpS682P5WDNIKcupsfNZ/lCYjw4eaybFx/a2jQW4B1r+H7wugbUPDCYfJ7mV7ppkAkUZYZzSuuKsU+olA70NuR1AUzm8CoepKkhYub65GZDTAIeH5WuHG0sOfUPYaQtbEB3NKc2/AHduWLqX2o2j2Uj89Fyz0oarLBWm41aRPKvJ17lkjFYcIKMaCEAa2NXEkNv4SRtfUHoo7125+Xp6AXpNiw+yzxaSfGV7kbV1M7v6Lg==; Received: from [194.100.51.2] (helo=perseus.local) by fanzine.igalia.com with esmtpsa (Cipher TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim) id 1gD49O-0002e8-Jk; Thu, 18 Oct 2018 10:59:26 +0200 Received: from berto by perseus.local with local (Exim 4.89) (envelope-from ) id 1gD495-00046d-Ah; Thu, 18 Oct 2018 11:59:07 +0300 From: Alberto Garcia To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 11:59:04 +0300 Message-Id: X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy] X-Received-From: 91.117.99.155 Subject: [Qemu-devel] [PATCH 2/2] iotest: Test x-blockdev-change on a Quorum X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Alberto Garcia , qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP This patch tests that you can add and remove drives from a Quorum using the x-blockdev-change command. Signed-off-by: Alberto Garcia --- tests/qemu-iotests/081 | 86 ++++++++++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/081.out | 54 +++++++++++++++++++++++++++++ 2 files changed, 140 insertions(+) diff --git a/tests/qemu-iotests/081 b/tests/qemu-iotests/081 index 0ea010afbf..7a441f9300 100755 --- a/tests/qemu-iotests/081 +++ b/tests/qemu-iotests/081 @@ -198,6 +198,92 @@ quorum="$quorum,file.children.2.driver=raw" $QEMU_IO -c "open -o $quorum" | _filter_qemu_io +echo +echo "== dinamically adding a child to a quorum ==" + +for verify in false true; do + run_qemu <