From patchwork Mon Feb 8 14:14:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alberto Garcia X-Patchwork-Id: 8250001 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5B7AD9F3CD for ; Mon, 8 Feb 2016 14:14:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A1077201E4 for ; Mon, 8 Feb 2016 14:14:48 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id D21A9201D3 for ; Mon, 8 Feb 2016 14:14:47 +0000 (UTC) Received: from localhost ([::1]:45143 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aSmaV-0006YN-4t for patchwork-qemu-devel@patchwork.kernel.org; Mon, 08 Feb 2016 09:14:47 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52235) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aSmaF-0006Ts-FX for qemu-devel@nongnu.org; Mon, 08 Feb 2016 09:14:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aSmaB-0004Ud-It for qemu-devel@nongnu.org; Mon, 08 Feb 2016 09:14:31 -0500 Received: from smtp3.mundo-r.com ([212.51.32.191]:14872 helo=smtp4.mundo-r.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aSmaB-0004UI-4S; Mon, 08 Feb 2016 09:14:27 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2DjAgA/orhW/5tjdVtdGQEBAQEPAQEBAYMKgT+IW51CAQEBAQEBBQGBDwGQGoITAQ2BZoYNAoEqOBQBAQEBAQEBgQqEQgEBBHkQPxI8GxmIHwG8ZQEBAQcghUqCPYsuBYdTjyKIOIUYgVuNGIVuiFAeAQFCg2ZoiFMBAQE X-IPAS-Result: A2DjAgA/orhW/5tjdVtdGQEBAQEPAQEBAYMKgT+IW51CAQEBAQEBBQGBDwGQGoITAQ2BZoYNAoEqOBQBAQEBAQEBgQqEQgEBBHkQPxI8GxmIHwG8ZQEBAQcghUqCPYsuBYdTjyKIOIUYgVuNGIVuiFAeAQFCg2ZoiFMBAQE X-IronPort-AV: E=Sophos;i="5.22,416,1449529200"; d="scan'208";a="14096452" Received: from fanzine.igalia.com ([91.117.99.155]) by smtp4.mundo-r.com with ESMTP; 08 Feb 2016 15:14:21 +0100 Received: from dsl-hkibrasgw4-50df50-201.dhcp.inet.fi ([80.223.80.201] helo=perseus.local) by fanzine.igalia.com with esmtpsa (Cipher TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim) id 1aSma5-0003Dd-GW; Mon, 08 Feb 2016 15:14:21 +0100 Received: from berto by perseus.local with local (Exim 4.86) (envelope-from ) id 1aSmZr-00064l-To; Mon, 08 Feb 2016 16:14:07 +0200 From: Alberto Garcia To: qemu-devel@nongnu.org Date: Mon, 8 Feb 2016 16:14:04 +0200 Message-Id: X-Mailer: git-send-email 2.7.0 In-Reply-To: <7bfce913f68d95284746e7cf3693703f5361b26f.1454940776.git.berto@igalia.com> References: <7bfce913f68d95284746e7cf3693703f5361b26f.1454940776.git.berto@igalia.com> In-Reply-To: <7bfce913f68d95284746e7cf3693703f5361b26f.1454940776.git.berto@igalia.com> References: <7bfce913f68d95284746e7cf3693703f5361b26f.1454940776.git.berto@igalia.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 212.51.32.191 Cc: Kevin Wolf , Alberto Garcia , qemu-block@nongnu.org, Max Reitz Subject: [Qemu-devel] [PATCH 2/3] iotests: Update test 139 after the changes in x-blockdev-del 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Now that we allow x-blockdev-del to work in a new scenario that previously forbidden we must update the iotests in order to reflect this change. Both testAttachMedia() and testSnapshot() are splitted in two: one version keeps the previous behavior, and a second version checks that the new functionality works as expected. Signed-off-by: Alberto Garcia --- tests/qemu-iotests/139 | 30 +++++++++++++++++++++++++----- tests/qemu-iotests/139.out | 4 ++-- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/tests/qemu-iotests/139 b/tests/qemu-iotests/139 index a4b9694..a6fc299 100644 --- a/tests/qemu-iotests/139 +++ b/tests/qemu-iotests/139 @@ -330,21 +330,32 @@ class TestBlockdevDel(iotests.QMPTestCase): self.delDeviceModel('device0') self.delBlockBackend('drive0', 'node0') - def testAttachMedia(self): + def testAttachMedia1(self): # This creates a BlockBackend and removes its media self.addBlockBackend('drive0', 'node0') self.ejectDrive('drive0', 'node0') # This creates a new BlockDriverState and inserts it into the backend self.addBlockDriverState('node1') self.insertDrive('drive0', 'node1') - # The backend can't be removed: the new BDS has an extra reference - self.delBlockBackend('drive0', 'node1', expect_error = True) + # The BDS can't be removed because it's attached to a backend self.delBlockDriverState('node1', expect_error = True) # The BDS still exists after being ejected, but now it can be removed self.ejectDrive('drive0', 'node1', destroys_media = False) self.delBlockDriverState('node1') self.delBlockBackend('drive0', None) + def testAttachMedia2(self): + # This creates a BlockBackend and removes its media + self.addBlockBackend('drive0', 'node0') + self.ejectDrive('drive0', 'node0') + # This creates a new BlockDriverState and inserts it into the backend + self.addBlockDriverState('node1') + self.insertDrive('drive0', 'node1') + # The BlockDriverState has a monitor reference so we can destroy the backend + self.delBlockBackend('drive0', 'node1', destroys_media = False) + # The backend has been destroyed, now we can proceed with the BDS + self.delBlockDriverState('node1') + def testSnapshotSync(self): self.addBlockBackend('drive0', 'node0') self.createSnapshotSync('node0', 'overlay0') @@ -354,11 +365,10 @@ class TestBlockdevDel(iotests.QMPTestCase): self.delBlockBackend('drive0', 'overlay0') self.checkBlockDriverState('node0', False) - def testSnapshot(self): + def testSnapshot1(self): self.addBlockBackend('drive0', 'node0') self.addBlockDriverStateOverlay('overlay0') self.createSnapshot('node0', 'overlay0') - self.delBlockBackend('drive0', 'overlay0', expect_error = True) self.delBlockDriverState('node0', expect_error = True) self.delBlockDriverState('overlay0', expect_error = True) self.ejectDrive('drive0', 'overlay0', destroys_media = False) @@ -367,6 +377,16 @@ class TestBlockdevDel(iotests.QMPTestCase): self.delBlockDriverState('overlay0') self.checkBlockDriverState('node0', False) + def testSnapshot2(self): + self.addBlockBackend('drive0', 'node0') + self.addBlockDriverStateOverlay('overlay0') + self.createSnapshot('node0', 'overlay0') + # The BlockDriverState has a monitor reference so we can destroy the backend + self.delBlockBackend('drive0', 'overlay0', destroys_media = False) + self.delBlockDriverState('node0', expect_error = True) + self.delBlockDriverState('overlay0') + self.checkBlockDriverState('node0', False) + def testMirror(self): self.addBlockBackend('drive0', 'node0') self.createMirror('drive0', 'node0', 'mirror0') diff --git a/tests/qemu-iotests/139.out b/tests/qemu-iotests/139.out index 281b69e..6323079 100644 --- a/tests/qemu-iotests/139.out +++ b/tests/qemu-iotests/139.out @@ -1,5 +1,5 @@ -............ +.............. ---------------------------------------------------------------------- -Ran 12 tests +Ran 14 tests OK