Skip to content

Commit

Permalink
qemu_storage: support the vdpa device
Browse files Browse the repository at this point in the history
add vdpa device support to the related functions

Signed-off-by: Houqi (Nick) Zuo <[email protected]>
  • Loading branch information
nickzhq committed Sep 12, 2023
1 parent c5225ad commit 1e1c540
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions virttest/env_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,8 @@ def postprocess_image(test, params, image_name, vm_process_status=None):
restored, removed = (False, False)
clone_master = params.get("clone_master", None)
base_dir = params.get("images_base_dir", data_dir.get_data_dir())
if params.get("storage_type") == "vhost-vdpa":
return
image = qemu_storage.QemuImg(params, base_dir, image_name)

if params.get("img_check_failed") == "yes":
Expand Down
10 changes: 10 additions & 0 deletions virttest/qemu_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,11 @@ def filename_to_file_opts(filename):

if matches['user'] is not None:
file_opts['username'] = matches['user']
# FIXME: vdpa is a customized protocol instead of a standard protocol.
elif filename.startswith("vdpa:"):
# filename[7:] mean: remove the prefix "vdpa://"
file_opts = {'driver': 'virtio-blk-vhost-vdpa',
'path': filename[7:]}
# FIXME: Judge the host device by the string starts with "/dev/".
elif filename.startswith('/dev/'):
file_opts = {'driver': 'host_device', 'filename': filename}
Expand Down Expand Up @@ -517,7 +522,12 @@ def __init__(self, params, root_dir, tag):
:param params: Dictionary containing the test parameters.
:param root_dir: Base directory for relative filenames.
:param tag: Image tag defined in parameter images
:raise NotImplementedError: If the image type is not supported.
"""
if params.get("storage_type") == "vhost-vdpa":
raise NotImplementedError("Vdpa is NOT supported to handle "
"the image!")
storage.QemuImg.__init__(self, params, root_dir, tag)
self.image_cmd = utils_misc.get_qemu_img_binary(params)
q_result = process.run(self.image_cmd + ' -h', ignore_status=True,
Expand Down

0 comments on commit 1e1c540

Please sign in to comment.