提交 6dec64a6 编写于 作者: X Xueqiang Wei

add new error message when creating large image over xfs filesystem

The following error messages should all work well.
1. Image size must be less than 8 EiB!
2. Invalid image size specified.
   Must be between 0 and 9223372036854775807.
Signed-off-by: NXueqiang Wei <xuwei@redhat.com>
上级 7c4d807f
......@@ -11,7 +11,8 @@
- over_xfs:
file_sys = "xfs"
image_size_large = 10240000T
err_info = "Image size must be less than 8 EiB!"
err_info = "Image size must be less than 8 EiB!;"
err_info = '${err_info}Invalid image size specified. Must be between 0 and 9223372036854775807.'
- over_ext4:
file_sys = "ext4"
image_size_large = 16T
......
import logging
import os
import six
from avocado import TestError
from avocado.utils import partition as p
......@@ -25,6 +26,7 @@ def run(test, params, env):
loop_img = os.path.join(root_dir, "loop.img")
loop_size = int(params["loop_file_size"])
file_sys = params["file_sys"]
err_info = params["err_info"].split(";")
mnt_dir = os.path.join(root_dir, "tmp")
large = QemuImg(params.object_params(large_img), mnt_dir, large_img)
......@@ -38,11 +40,14 @@ def run(test, params, env):
try:
large.create(large.params)
except TestError as err:
if params["err_info"] not in str(err):
for info in err_info:
if info in six.text_type(err):
break
else:
test.fail("CML failed with unexpected output: %s" % err)
else:
test.fail("There is no error when creating an image with large size.")
part.unmount()
os.rmdir(mnt_dir)
os.remove(loop_img)
finally:
part.unmount()
os.rmdir(mnt_dir)
os.remove(loop_img)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册