qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: qemu-block@nongnu.org
Cc: qemu-devel@nongnu.org, Max Reitz <mreitz@redhat.com>,
	Kevin Wolf <kwolf@redhat.com>, Eric Blake <eblake@redhat.com>
Subject: [Qemu-devel] [PATCH v6 9/9] iotests: Test changed Quorum filename
Date: Mon, 16 Jan 2017 17:13:54 +0100	[thread overview]
Message-ID: <20170116161354.8011-3-mreitz@redhat.com> (raw)
In-Reply-To: <20170113205237.30386-1-mreitz@redhat.com>

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 <mreitz@redhat.com>
---
 tests/qemu-iotests/041 | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/tests/qemu-iotests/041 b/tests/qemu-iotests/041
index bc6cf782fe..aa6efa5b5b 100755
--- a/tests/qemu-iotests/041
+++ b/tests/qemu-iotests/041
@@ -18,6 +18,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 
+import json
 import time
 import os
 import iotests
@@ -961,9 +962,18 @@ class TestRepairQuorum(iotests.QMPTestCase):
         self.assert_qmp(result, 'return', {})
 
         self.complete_and_wait('job0')
-        self.assert_has_block_node("repair0", 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__':
-- 
2.11.0

  parent reply	other threads:[~2017-01-16 16:14 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-13 20:52 [Qemu-devel] [PATCH v6 0/9] block: Drop BDS.filename Max Reitz
2017-01-13 20:52 ` [Qemu-devel] [PATCH v6 1/9] block: Always set *file in get_block_status Max Reitz
2017-01-16 20:44   ` Eric Blake
2017-01-13 20:52 ` [Qemu-devel] [PATCH v6 2/9] block: Change bdrv_get_encrypted_filename() Max Reitz
2017-01-13 20:52 ` [Qemu-devel] [PATCH v6 3/9] block: Avoid BlockDriverState.filename Max Reitz
2017-01-16 20:46   ` Eric Blake
2017-01-13 20:52 ` [Qemu-devel] [PATCH v6 4/9] block: Do not blindly copy filename from file Max Reitz
2017-01-16 20:48   ` Eric Blake
2017-01-13 20:52 ` [Qemu-devel] [PATCH v6 5/9] block: Add bdrv_filename() Max Reitz
2017-01-16 21:33   ` Eric Blake
2017-01-16 16:13 ` [Qemu-devel] [PATCH v6 7/9] block: Drop BlockDriverState.filename Max Reitz
2017-01-16 16:13 ` [Qemu-devel] [PATCH v6 8/9] block: Complete move to pull filename updates Max Reitz
2017-01-16 16:13 ` Max Reitz [this message]
2017-01-16 16:15 ` [Qemu-devel] [PATCH v6 6/9] qemu-img: Use bdrv_filename() for map Max Reitz
2017-01-16 21:45   ` Eric Blake
2017-01-16 16:17 ` [Qemu-devel] [PATCH v6 0/9] block: Drop BDS.filename Max Reitz

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=20170116161354.8011-3-mreitz@redhat.com \
    --to=mreitz@redhat.com \
    --cc=eblake@redhat.com \
    --cc=kwolf@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).