From: Alberto Garcia <berto@igalia.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Alberto Garcia <berto@igalia.com>,
qemu-block@nongnu.org, Max Reitz <mreitz@redhat.com>
Subject: [Qemu-devel] [PATCH 2/3] iotests: Update test 139 after the changes in x-blockdev-del
Date: Mon, 8 Feb 2016 16:14:04 +0200 [thread overview]
Message-ID: <d8f82a10b50ca13b510cdee9aa5827fe74fafdcb.1454940776.git.berto@igalia.com> (raw)
In-Reply-To: <7bfce913f68d95284746e7cf3693703f5361b26f.1454940776.git.berto@igalia.com>
In-Reply-To: <7bfce913f68d95284746e7cf3693703f5361b26f.1454940776.git.berto@igalia.com>
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 <berto@igalia.com>
---
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
--
2.7.0
next prev parent reply other threads:[~2016-02-08 14:14 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-08 14:14 [Qemu-devel] [PATCH 1/3] block: Allow x-blockdev-del on a BB with a monitor-owned BDS Alberto Garcia
2016-02-08 14:14 ` Alberto Garcia [this message]
2016-02-09 15:36 ` [Qemu-devel] [PATCH 2/3] iotests: Update test 139 after the changes in x-blockdev-del Eric Blake
2016-02-09 15:44 ` Alberto Garcia
2016-02-08 14:14 ` [Qemu-devel] [PATCH 3/3] block: Update the x-blockdev-del documentation Alberto Garcia
2016-02-09 15:38 ` Eric Blake
2016-02-09 10:32 ` [Qemu-devel] [PATCH 1/3] block: Allow x-blockdev-del on a BB with a monitor-owned BDS Kevin Wolf
2016-02-09 10:47 ` Alberto Garcia
2016-02-09 15:34 ` Eric Blake
2016-02-09 15:39 ` Alberto Garcia
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d8f82a10b50ca13b510cdee9aa5827fe74fafdcb.1454940776.git.berto@igalia.com \
--to=berto@igalia.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).