提交 9293b453 编写于 作者: G Gerd Hoffmann 提交者: Lucas Meneghel Rodrigues

image_copy: support compressed images

This patch adds support for compressed images in the image_copy test.
This reduces the time for the image copy from around three minutes to
less than one minute (over Gigabit Ethernet).

gzip and xz are supported.  xz produces smaller images but needs more
cpu time for decompressing.  In my setup gzip is limited by network
bandwidth whereas xz is limited by cpu speed.  In the end both are
almost on par speed-wise, with gzip being a little bit faster.
Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
上级 350a9384
......@@ -31,15 +31,22 @@ def run_image_copy(test, params, env):
params['image_format'])
src_path = os.path.join(mount_dest_dir, image)
dst_path = '%s/%s.%s' % (data_dir.get_data_dir(), params['image_name'], params['image_format'])
cmd = 'cp %s %s' % (src_path, dst_path)
if not utils_misc.mount(src, mount_dest_dir, 'nfs', 'ro'):
raise error.TestError('Could not mount NFS share %s to %s' %
(src, mount_dest_dir))
# Check the existence of source image
if not os.path.exists(src_path):
if os.path.exists("%s.xz" % src_path):
logging.debug('Copying image %s (from xz) ...', image)
cmd = "xz -cd %s.xz > %s" % (src_path, dst_path)
elif os.path.exists("%s.gz" % src_path):
logging.debug('Copying image %s (from gzip) ...', image)
cmd = "gzip -cd %s.gz > %s" % (src_path, dst_path)
elif os.path.exists(src_path):
logging.debug('Copying image %s (uncompressed) ...', image)
cmd = 'cp %s %s' % (src_path, dst_path)
else:
raise error.TestError('Could not find %s in NFS share' % src_path)
logging.debug('Copying image %s...', image)
utils.system(cmd)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册