提交 3e0a504f 编写于 作者: A Aihua Liang

check_block_size:add windows guest for test

qemu.tests.check_block_size:
1.add block check cmd for windows
2.set param "physical_block_size_stg" default value to "512"

qemu.tests.cfg.check_block_size:
1.add test guest--windows
2.disable win7 and win2008, no aviliable cmd for physical_block_size
3.divided cases to base and installation(avoid vfd installation)

Signed-off-by:Aihua Liang<aliang@redhat.com>
上级 825acc6c
- check_block_size:
only Linux
only virtio_blk
no Host_RHEL.m5
no RHEL.3 RHEL.4 RHEL.5
#No cmd support physical_block_size check for Win7,Win2008 and Win2008r2
no Win7 Win2008
type = check_block_size
virt_test_type = qemu
kill_vm = yes
......@@ -11,12 +11,19 @@
index_enable = no
image_name_stg = "images/check_block_size_image"
image_size_stg = 20G
image_verify_bootable = no
force_create_image_stg = yes
drive_serial_stg = "TARGET_DISK0"
cdroms += " unattended"
unattended_delivery_method = cdrom
chk_phy_blk_cmd = "cat /sys/block/%s/queue/physical_block_size"
chk_log_blk_cmd = "cat /sys/block/%s/queue/logical_block_size"
chk_blks_cmd_windows = "powershell "get-disk|format-list""
variants:
- extra_cdrom_ks:
no 4096_4096
- base:
only 4096_4096
variants:
- 4096_4096:
need_install = no
......
import logging
import re
from autotest.client.shared import error
......@@ -43,21 +44,34 @@ def run(test, params, env):
try:
# Get virtio block devices in guest.
drive_serial = str(params["drive_serial_stg"])
drive_path = utils_misc.get_linux_drive_path(session, drive_serial)
if not drive_path:
raise error.TestError("Could not find the specified"
"virtio block device.")
drive_kname = drive_path.split("/")[-1]
expect_physical = int(params.get("physical_block_size_stg", 0))
expect_logical = int(params.get("logical_block_size_stg", 0))
expect_physical = int(params.get("physical_block_size_stg", 512))
expect_logical = int(params.get("logical_block_size_stg", 512))
error.context("Verify physical/Logical block size", logging.info)
cmd = params.get("chk_phy_blk_cmd") % drive_kname
logging.debug("Physical block size get via '%s'" % cmd)
out_physical = int(session.cmd_output(cmd))
cmd = params.get("chk_log_blk_cmd") % drive_kname
logging.debug("Logical block size get via '%s'" % cmd)
out_logical = int(session.cmd_output(cmd))
if params["os_type"] == "linux":
drive_path = utils_misc.get_linux_drive_path(session, drive_serial)
if not drive_path:
raise error.TestError("Could not find the specified"
"virtio block device.")
drive_kname = drive_path.split("/")[-1]
cmd = params.get("chk_phy_blk_cmd") % drive_kname
logging.debug("Physical block size get via '%s'" % cmd)
out_physical = int(session.cmd_output(cmd))
cmd = params.get("chk_log_blk_cmd") % drive_kname
logging.debug("Logical block size get via '%s'" % cmd)
out_logical = int(session.cmd_output(cmd))
else:
cmd = params.get("chk_blks_cmd_windows")
logging.debug("Physical/Logical block size get via '%s'" % cmd)
out_bs = session.cmd_output(cmd, timeout=240).strip().split("\n\n")
for blk_info in out_bs:
if blk_info.find(drive_serial) != -1:
target_blk = blk_info
break
else:
raise error.TestError("Could not find the specified device")
out_physical = int(re.search(r'PhysicalSectorSize\s*:\s*(\d+)', target_blk).group(1))
out_logical = int(re.search(r'LogicalSectorSize\s*:\s(\d+)', target_blk).group(1))
if ((out_physical != expect_physical) or
(out_logical != expect_logical)):
msg = "Block size in guest doesn't match with qemu parameter\n"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册