From patchwork Wed Aug 5 20:52:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Reitz X-Patchwork-Id: 504207 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 05C341402B8 for ; Thu, 6 Aug 2015 06:56:53 +1000 (AEST) Received: from localhost ([::1]:42120 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZN5k3-0007Sn-8b for incoming@patchwork.ozlabs.org; Wed, 05 Aug 2015 16:56:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46707) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZN5gp-00021G-VT for qemu-devel@nongnu.org; Wed, 05 Aug 2015 16:53:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZN5go-0004VT-R8 for qemu-devel@nongnu.org; Wed, 05 Aug 2015 16:53:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53222) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZN5gk-0004Gf-Ep; Wed, 05 Aug 2015 16:53:26 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id 0CC5636B1C7; Wed, 5 Aug 2015 20:53:26 +0000 (UTC) Received: from localhost (ovpn-116-43.ams2.redhat.com [10.36.116.43]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t75KrKaG011715 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 5 Aug 2015 16:53:25 -0400 From: Max Reitz To: qemu-block@nongnu.org Date: Wed, 5 Aug 2015 22:52:49 +0200 Message-Id: <1438807969-9723-6-git-send-email-mreitz@redhat.com> In-Reply-To: <1438807969-9723-1-git-send-email-mreitz@redhat.com> References: <1438807969-9723-1-git-send-email-mreitz@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Kevin Wolf , qemu-devel@nongnu.org, Stefan Hajnoczi , Max Reitz Subject: [Qemu-devel] [PATCH v2 5/5] iotests: Test changed Quorum filename X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org After drive-mirror replacing a Quorum child, the filename of the Quorum BDS should reflect the change. This patch replaces the existing test for whether the operation did actually exchange the BDS (which simply tested whether the new BDS existed) by a test which examines the children list contained in the Quorum BDS's filename as returned by query-block. As a nice side effect of confirming that the new BDS actually belongs to the Quorum BDS, this checks whether the filename was properly updated. Signed-off-by: Max Reitz --- tests/qemu-iotests/041 | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/tests/qemu-iotests/041 b/tests/qemu-iotests/041 index 3d46ed7..316f42a 100755 --- a/tests/qemu-iotests/041 +++ b/tests/qemu-iotests/041 @@ -18,6 +18,7 @@ # along with this program. If not, see . # +import json import time import os import iotests @@ -908,10 +909,18 @@ class TestRepairQuorum(iotests.QMPTestCase): self.assert_qmp(result, 'return', {}) self.complete_and_wait(drive="quorum0") - result = self.vm.qmp('query-named-block-nodes') - self.assert_qmp(result, 'return[0]/file', quorum_repair_img) - # TODO: a better test requiring some QEMU infrastructure will be added - # to check that this file is really driven by quorum + + result = self.vm.qmp('query-block') + for blockdev in result['return']: + if blockdev['device'] == 'quorum0': + filename = blockdev['inserted']['image']['filename'] + self.assertEquals(filename[:5], 'json:') + children = json.loads(filename[5:])['children'] + self.assertEquals(children[0]['file']['filename'], quorum_img1) + self.assertEquals(children[1]['file']['filename'], + quorum_repair_img) + self.assertEquals(children[2]['file']['filename'], quorum_img3) + self.vm.shutdown() if __name__ == '__main__':