From: Kevin Wolf <kwolf@redhat.com>
To: qemu-block@nongnu.org
Cc: kwolf@redhat.com, famz@redhat.com, mreitz@redhat.com,
jcody@redhat.com, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH for-2.6 v3 2/3] iotests: Add iotests.image_size
Date: Wed, 20 Apr 2016 16:32:45 +0200 [thread overview]
Message-ID: <1461162766-907-3-git-send-email-kwolf@redhat.com> (raw)
In-Reply-To: <1461162766-907-1-git-send-email-kwolf@redhat.com>
From: Fam Zheng <famz@redhat.com>
This retrieves the virtual size of the image out of qemu-img info.
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
tests/qemu-iotests/iotests.py | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index d9ef60e..56f988a 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -28,6 +28,7 @@ sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'scripts', '
import qmp
import qtest
import struct
+import json
# This will not work if arguments contain spaces but is necessary if we
@@ -103,6 +104,11 @@ def create_image(name, size):
i = i + 512
file.close()
+def image_size(img):
+ '''Return image's virtual size'''
+ r = qemu_img_pipe('info', '--output=json', '-f', imgfmt, img)
+ return json.loads(r)['virtual-size']
+
test_dir_re = re.compile(r"%s" % test_dir)
def filter_test_dir(msg):
return test_dir_re.sub("TEST_DIR", msg)
--
1.8.3.1
next prev parent reply other threads:[~2016-04-20 14:33 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-20 14:32 [Qemu-devel] [PATCH for-2.6 v3 0/3] block: Fix drive-mirror with image size unaligned with granularity Kevin Wolf
2016-04-20 14:32 ` [Qemu-devel] [PATCH for-2.6 v3 1/3] mirror: Don't extend the last sub-chunk Kevin Wolf
2016-04-20 14:46 ` Max Reitz
2016-04-20 14:47 ` Jeff Cody
2016-04-20 14:32 ` Kevin Wolf [this message]
2016-04-20 14:48 ` [Qemu-devel] [PATCH for-2.6 v3 2/3] iotests: Add iotests.image_size Jeff Cody
2016-04-20 14:32 ` [Qemu-devel] [PATCH for-2.6 v3 3/3] iotests: Test case for drive-mirror with unaligned image size Kevin Wolf
2016-04-20 14:49 ` Max Reitz
2016-04-20 14:50 ` Jeff Cody
2016-04-20 14:51 ` [Qemu-devel] [PATCH for-2.6 v3 0/3] block: Fix drive-mirror with image size unaligned with granularity Jeff Cody
2016-04-20 14:59 ` Jeff Cody
2016-04-21 2:12 ` Fam Zheng
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=1461162766-907-3-git-send-email-kwolf@redhat.com \
--to=kwolf@redhat.com \
--cc=famz@redhat.com \
--cc=jcody@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).