未验证 提交 dca0d628 编写于 作者: X Xu Han 提交者: GitHub

Merge pull request #1080 from aliang123/1434263

block_hotplug: add support for data plane
import logging
import re
import time
from virttest import data_dir
from virttest import storage
......@@ -60,7 +59,8 @@ def run(test, params, env):
img_list = params.get("images").split()
img_format_type = params.get("img_format_type", "qcow2")
pci_type = params.get("pci_type", "virtio-blk-pci")
pause = float(params.get("virtio_block_pause", 5.0))
#sometimes, ppc can't get new plugged disk in 5s, so time to 10s
pause = float(params.get("virtio_block_pause", 10.0))
blk_num = int(params.get("blk_num", 1))
repeat_times = int(params.get("repeat_times", 3))
timeout = int(params.get("login_timeout", 360))
......@@ -87,17 +87,24 @@ def run(test, params, env):
for num in xrange(blk_num):
device = qdevices.QDevice(pci_type)
if params.get("need_plug") == "yes":
disks_before_plug = find_disk(vm, get_disk_cmd)
if params.get("need_controller", "no") == "yes":
controller_model = params.get("controller_model")
controller = qdevices.QDevice(controller_model)
bus_extra_param = params.get("bus_extra_params_%s" % img_list[num + 1])
# TODO:Add iothread support for qdevice
if bus_extra_param and "iothread" in bus_extra_param:
match = re.search("iothread=(\w+)", bus_extra_param)
if match:
qdevice_params = {"iothread": match.group(1)}
controller.params.update(qdevice_params)
controller.hotplug(vm.monitor)
ver_out = controller.verify_hotplug("", vm.monitor)
if not ver_out:
err = "%s is not in qtree after hotplug" % controller_model
test.fail(err)
disks_before_plug = find_disk(vm, get_disk_cmd)
drive = qdevices.QRHDrive("block%d" % num)
drive.set_param("file", find_image(img_list[num + 1]))
drive.set_param("format", img_format_type)
......@@ -106,15 +113,23 @@ def run(test, params, env):
device.set_param("drive", drive_id)
device.set_param("id", "block%d" % num)
blk_extra_param = params.get("blk_extra_params_%s" % img_list[num + 1])
if blk_extra_param and "iothread" in blk_extra_param:
match = re.search("iothread=(\w+)", blk_extra_param)
if match:
device.set_param("iothread", match.group(1))
device.hotplug(vm.monitor)
ver_out = device.verify_hotplug("", vm.monitor)
if not ver_out:
err = "%s is not in qtree after hotplug" % pci_type
test.fail(err)
time.sleep(pause)
disks_after_plug = find_disk(vm, get_disk_cmd)
new_disks = get_new_disk(disks_before_plug, disks_after_plug)
plug_status = utils_misc.wait_for(lambda: len(get_new_disk(disks_before_plug,
find_disk(vm, get_disk_cmd))) != 0, pause)
if plug_status:
disks_after_plug = find_disk(vm, get_disk_cmd)
new_disks = get_new_disk(disks_before_plug, disks_after_plug)
else:
test.fail("Can't get new disks")
else:
if params.get("drive_format") in pci_type:
get_disk_cmd += " | egrep -v '^/dev/[hsv]da[0-9]*$'"
......@@ -173,9 +188,13 @@ def run(test, params, env):
for num in xrange(blk_num):
error_context.context("Unplug block device (iteration %d)" % iteration,
logging.info)
disks_before_unplug = find_disk(vm, get_disk_cmd)
device_list[num].unplug(vm.monitor)
device_list[num].verify_unplug("", vm.monitor)
time.sleep(pause)
unplug_status = utils_misc.wait_for(lambda: len(get_new_disk(find_disk(vm, get_disk_cmd),
disks_before_unplug)) != 0, pause)
if not unplug_status:
test.fail("Failed to unplug disks")
sub_type = params.get("sub_type_after_unplug")
if sub_type:
......
......@@ -87,8 +87,6 @@
drive_format_stg0 = virtio
drive_format_stg1 = virtio
get_disk_pattern = "^/dev/vd[a-z]*$"
virtio_blk:
no ppc64 ppc64le
- block_scsi:
pci_type = scsi-hd
drive_format_stg0 = scsi-hd
......@@ -97,3 +95,17 @@
virtio_blk:
need_controller = yes
controller_model = virtio-scsi-pci
variants:
- @default:
- data_plane:
no Host_RHEL.m6
only with_plug.with_system_reset.one_pci
one_pci:
repeat_times = 1
iothreads = iothread0
block_virtio:
blk_extra_params_stg0 = "iothread=${iothreads}"
block_scsi:
no Host_RHEL.m7.u0, Host_RHEL.m7.u1, Host_RHEL.m7.u2
bus_extra_params_stg0 = "iothread=${iothreads}"
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册