Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update disk related API to adopt utils_disk #2221

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion libvirt/tests/src/bios/virsh_boot.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from virttest.libvirt_xml.devices.disk import Disk
from virttest.utils_test import libvirt as utlv
from virttest import utils_misc
from virttest import utils_disk
from virttest import data_dir
from virttest import ceph

Expand Down Expand Up @@ -426,7 +427,7 @@ def prepare_gluster_disk(blk_source, test, **kwargs):
host_ip = utlv.setup_or_cleanup_gluster(True, vol_name, brick_path)
logging.debug("host ip: %s ", host_ip)
# Copy the domain disk image to gluster disk path
image_info = utils_misc.get_image_info(blk_source)
image_info = utils_disk.get_image_info(blk_source)
dest_image = "/mnt/%s" % disk_img
if image_info["format"] == disk_format:
disk_cmd = ("cp -f %s %s" % (blk_source, dest_image))
Expand Down
7 changes: 4 additions & 3 deletions libvirt/tests/src/migration/migrate_vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from virttest import utils_config
from virttest import utils_libvirtd
from virttest import utils_misc
from virttest import utils_disk
from virttest import utils_netperf
from virttest import utils_package
from virttest import utils_selinux
Expand Down Expand Up @@ -371,7 +372,7 @@ def prepare_gluster_disk(params):
host_ip = libvirt.setup_or_cleanup_gluster(True, vol_name,
brick_path, pool_name)
logging.debug("host ip: %s ", host_ip)
image_info = utils_misc.get_image_info(image_source)
image_info = utils_disk.get_image_info(image_source)
if image_info["format"] == disk_format:
disk_cmd = ("cp -f %s /mnt/%s" % (image_source, disk_img))
else:
Expand Down Expand Up @@ -1445,7 +1446,7 @@ def run(test, params, env):
if disk_name or disk_type or disk_cache:
update_disk_driver(vm_name, disk_name, disk_type, disk_cache)

image_info_dict = utils_misc.get_image_info(disk_source)
image_info_dict = utils_disk.get_image_info(disk_source)
logging.debug("disk image info: %s", image_info_dict)
target_image_source = test_dict.get("target_image_source", disk_source)
cmd = test_dict.get("create_another_target_image_cmd")
Expand Down Expand Up @@ -1735,7 +1736,7 @@ def run(test, params, env):
local_image_source = test_dict.get("local_image_source")
tgt_size = 0
if local_image_source and check_image_size:
image_info_dict = utils_misc.get_image_info(local_image_source)
image_info_dict = utils_disk.get_image_info(local_image_source)
logging.debug("Local disk image info: %s", image_info_dict)

dsize = image_info_dict["dsize"]
Expand Down
3 changes: 2 additions & 1 deletion libvirt/tests/src/npiv/npiv_concurrent.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from virttest import virsh
from virttest import utils_misc
from virttest import utils_disk
from virttest import utils_npiv
from virttest.libvirt_xml import vm_xml
from virttest.libvirt_xml.devices import disk
Expand Down Expand Up @@ -263,7 +264,7 @@ def run(test, params, env):
path_to_blk = os.path.join(_BYPATH_DIR, lun_dev)
path_to_blks.append(path_to_blk)
img_src = vm.get_first_disk_devices()['source']
img_info = utils_misc.get_image_info(img_src)
img_info = utils_disk.get_image_info(img_src)
src_fmt = img_info["format"]
dest_fmt = "qcow2"
convert_img_to_dev(test, src_fmt, dest_fmt, img_src, path_to_blk)
Expand Down
5 changes: 3 additions & 2 deletions libvirt/tests/src/resource_abnormal.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from virttest import qemu_storage
from virttest import libvirt_vm
from virttest import utils_misc
from virttest import utils_disk
from virttest import virsh
from virttest import remote
from virttest import data_dir
Expand Down Expand Up @@ -175,7 +176,7 @@ def __init__(self, test, params):
xml_file = vm_xml.VMXML.new_from_inactive_dumpxml(self.vm_name)
disk_node = xml_file.get_disk_all()['vda']
source_file = disk_node.find('source').get('file')
self.image_size = utils_misc.get_image_info(source_file)['dsize']
self.image_size = utils_disk.get_image_info(source_file)['dsize']
# Set the size to be image_size
iscsi_size = "%sM" % (self.image_size / 1024 / 1024)
params['image_size'] = iscsi_size
Expand Down Expand Up @@ -341,7 +342,7 @@ def __init__(self, test, params):
xml_file = vm_xml.VMXML.new_from_inactive_dumpxml(self.vm_name)
disk_node = xml_file.get_disk_all()['vda']
source_file = disk_node.find('source').get('file')
image_type = utils_misc.get_image_info(source_file)['format']
image_type = utils_disk.get_image_info(source_file)['format']
if image_type != "qcow2":
self.test.cancel("Disk image format is not qcow2, "
"ignore snapshot test!")
Expand Down
2 changes: 1 addition & 1 deletion libvirt/tests/src/virsh_cmd/domain/virsh_blkiotune.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from virttest import libvirt_xml, utils_libvirtd, virsh
from virttest.staging import utils_cgroup
from virttest.utils_misc import get_dev_major_minor
from virttest.utils_disk import get_dev_major_minor
from virttest.compat_52lts import results_stdout_52lts


Expand Down
3 changes: 2 additions & 1 deletion libvirt/tests/src/virsh_cmd/domain/virsh_blockresize.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from virttest import virsh
from virttest import data_dir
from virttest import utils_misc
from virttest import utils_disk

from provider import libvirt_version

Expand Down Expand Up @@ -130,7 +131,7 @@ def run(test, params, env):
else:
test.error("Unknown scale value")

image_info = utils_misc.get_image_info(image_path)
image_info = utils_disk.get_image_info(image_path)
actual_size = int(image_info['vsize'])

logging.info("The expected block size is %s bytes, "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from virttest import utils_test
from virttest import virsh
from virttest import utils_misc
from virttest import utils_disk
from virttest import libvirt_vm
from virttest import virt_vm
from virttest import remote
Expand Down Expand Up @@ -146,7 +146,7 @@ def cleanup_ssh_config(vm):

sys_image = vm.get_first_disk_devices()
sys_image_source = sys_image["source"]
sys_image_info = utils_misc.get_image_info(sys_image_source)
sys_image_info = utils_disk.get_image_info(sys_image_source)
logging.debug("System image information:\n%s", sys_image_info)
sys_image_fmt = sys_image_info["format"]
created_img_path = os.path.join(os.path.dirname(sys_image_source),
Expand Down
6 changes: 3 additions & 3 deletions libvirt/tests/src/virsh_cmd/volume/virsh_vol_clone_wipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from virttest import libvirt_storage
from virttest import data_dir
from virttest import virsh
from virttest import utils_misc
from virttest import utils_disk
from virttest import libvirt_xml

from provider import libvirt_version
Expand Down Expand Up @@ -251,7 +251,7 @@ def run(test, params, env):
key, virsh_vol_info[key])
vol_path = virsh.vol_path(new_vol_name,
pool_name).stdout.strip()
qemu_vol_info = utils_misc.get_image_info(vol_path)
qemu_vol_info = utils_disk.get_image_info(vol_path)
for key in qemu_vol_info:
logging.debug("Wiped volume info(qemu): %s = %s",
key, qemu_vol_info[key])
Expand Down Expand Up @@ -287,7 +287,7 @@ def run(test, params, env):
key, virsh_vol_info[key])
vol_path = virsh.vol_path(vol_name,
pool_name).stdout.strip()
qemu_vol_info = utils_misc.get_image_info(vol_path)
qemu_vol_info = utils_disk.get_image_info(vol_path)
for key in qemu_vol_info:
logging.debug("Wiped volume info(qemu): %s = %s",
key, qemu_vol_info[key])
Expand Down
5 changes: 3 additions & 2 deletions libvirt/tests/src/virsh_cmd/volume/virsh_vol_resize.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

from virttest import libvirt_storage
from virttest import utils_misc
from virttest import utils_disk
from virttest import virsh
from virttest import libvirt_xml
from virttest.utils_test import libvirt
Expand Down Expand Up @@ -55,7 +56,7 @@ def get_expect_info(new_capacity, vol_path, test, resize_option=None):
new_size = utils_misc.normalize_data_size(new_capacity, "B", factor)

# Get image info
img_info = utils_misc.get_image_info(vol_path)
img_info = utils_disk.get_image_info(vol_path)

# Init expect_info
expect_info['Capacity'] = img_info['vsize']
Expand Down Expand Up @@ -197,7 +198,7 @@ def check_vol_info(pool_vol, vol_name, test, expect_info=None):
try:
# Get image info
vol_path = pool_vol.list_volumes()[vol_name]
img_info = utils_misc.get_image_info(vol_path)
img_info = utils_disk.get_image_info(vol_path)
if expect_info['Capacity'] != img_info['vsize']:
logging.debug("Capacity(Virtual size) is %s bytes",
img_info['vsize'])
Expand Down
3 changes: 2 additions & 1 deletion libvirt/tests/src/virsh_cmd/volume/virsh_volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from avocado.utils import process

from virttest import utils_misc
from virttest import utils_disk
from virttest import data_dir
from virttest import virsh
from virttest import libvirt_storage
Expand Down Expand Up @@ -243,7 +244,7 @@ def check_vol(expected, avail=True):
expected['name'])

# Check format from against qemu-img info
img_info = utils_misc.get_image_info(expected['path'])
img_info = utils_disk.get_image_info(expected['path'])
if expected['format']:
if expected['format'] != img_info['format']:
logging.error("Volume format mismatch for volume: %s\n"
Expand Down
3 changes: 2 additions & 1 deletion libvirt/tests/src/virtual_disks/virtual_disks_gluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from virttest import virsh
from virttest import data_dir
from virttest import utils_misc
from virttest import utils_disk
from virttest import virt_vm, remote
from virttest.utils_test import libvirt
from virttest.libvirt_xml import vm_xml
Expand Down Expand Up @@ -38,7 +39,7 @@ def prepare_gluster_disk(disk_img, disk_format):
host_ip = libvirt.setup_or_cleanup_gluster(True, vol_name,
brick_path, pool_name)
logging.debug("host ip: %s ", host_ip)
image_info = utils_misc.get_image_info(image_source)
image_info = utils_disk.get_image_info(image_source)
image_dest = "/mnt/%s" % disk_img

if image_info["format"] == disk_format:
Expand Down
3 changes: 2 additions & 1 deletion v2v/tests/src/v2v_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from virttest import data_dir
from virttest import ssh_key
from virttest import utils_misc
from virttest import utils_disk
from virttest import utils_v2v
from virttest import virsh
from virttest import remote
Expand Down Expand Up @@ -171,7 +172,7 @@ def check_image(img_path, check_point, expected_value):
"""
if not img_path or not os.path.isfile(img_path):
test.error("Image path: '%s' is invalid" % img_path)
img_info = utils_misc.get_image_info(img_path)
img_info = utils_disk.get_image_info(img_path)
logging.debug("Image info: %s", img_info)
if check_point == "allocation":
if expected_value == "sparse":
Expand Down