提交 cbab56a5 编写于 作者: Y Yongxue Hong

block_with_write_threshold: Support luks format

The filename is json format if the image format is luks, so
need to parse them and to get block device node name by filename
item instead of file item.
Signed-off-by: NYongxue Hong <yhong@redhat.com>
上级 f351a4b9
......@@ -5,10 +5,10 @@ from avocado.utils.wait import wait_for
from virttest import data_dir
from virttest import error_context
from virttest import storage
from virttest import utils_disk
from virttest import utils_test
from virttest import utils_misc
from virttest.qemu_storage import QemuImg, get_image_json
from provider.storage_benchmark import generate_instance
......@@ -36,10 +36,12 @@ def run(test, params, env):
def get_node_name(image_tag):
""" Get the node name. """
img_params = params.object_params(image_tag)
file = storage.get_image_filename(img_params, data_dir.get_data_dir())
for block in vm.monitor.info("block"):
if file == block['inserted']['file']:
return block['inserted']['node-name']
root_dir = data_dir.get_data_dir()
img = QemuImg(img_params, root_dir, image_tag)
filename = img.image_filename
if img.image_format == 'luks':
filename = get_image_json(image_tag, img_params, root_dir)
return vm.get_block({"filename": filename})
def set_block_write_threshold(monitor, node_name, size):
""" Set block write threshold for the block drive. """
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册