diff --git a/qemu/tests/block_hotplug.py b/qemu/tests/block_hotplug.py index 27a0ac0c79f2380fe675bcd6f7841c5adda6b20f..8621f070988da0886537e05c14cb2ef1e5f962c2 100644 --- a/qemu/tests/block_hotplug.py +++ b/qemu/tests/block_hotplug.py @@ -109,11 +109,10 @@ def run(test, params, env): controller = qdevices.QDevice(controller_model, params={"id": "hotadded_scsi%s" % num}) 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)} + if bus_extra_param: + for item in bus_extra_param.split(): + key, value = item.split("=", 1) + qdevice_params = {key: value} controller.params.update(qdevice_params) controller.hotplug(vm.monitor) ver_out = controller.verify_hotplug("", vm.monitor) @@ -134,10 +133,10 @@ def run(test, params, env): if params.get("need_controller", "no") == "yes" and bool(random.randrange(2)): device.set_param("bus", controller.get_param("id")+'.0') 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)) + if blk_extra_param: + for item in blk_extra_param.split(): + key, value = item.split("=", 1) + device.set_param(key, value) device.hotplug(vm.monitor) ver_out = device.verify_hotplug("", vm.monitor) if not ver_out: diff --git a/qemu/tests/cfg/block_hotplug.cfg b/qemu/tests/cfg/block_hotplug.cfg index 2321926f590bb7b155c02e09d814822f2a6bab56..8659eebe7bae2bca1b487b739433116dc54b1c99 100644 --- a/qemu/tests/cfg/block_hotplug.cfg +++ b/qemu/tests/cfg/block_hotplug.cfg @@ -59,6 +59,42 @@ sub_type_after_plug = boot sub_type_after_unplug = boot reboot_method = system_reset + - with_block_resize: + only with_plug + sub_type_after_plug = block_resize + blk_extra_params_stg0 += " serial=TARGET_DISK0" + block_size_cmd = "fdisk -l | grep {0}" + block_size_pattern = ",\s+(\d+\s+b)ytes" + disk_change_ratio = "1.5 0.5" + repeat_times = 1 + Windows: + block_size_cmd = "wmic diskdrive get size, index" + block_size_pattern = "1\s+(\d+)" + accept_ratio = 0.0005 + disk_update_cmd = "echo rescan > cmd" + disk_update_cmd += " && echo select disk 1 > cmd" + disk_update_cmd += " && echo select partition 1 >> cmd" + disk_update_cmd += " && echo extend >> cmd" + disk_update_cmd += " && echo exit >> cmd" + disk_update_cmd += " && diskpart /s cmd" + # "::" is used to separate the commands as it is not used in both Linux and Windows + disk_update_cmd += "::" + disk_update_cmd += "echo select disk 1 > cmd" + disk_update_cmd += " && echo select partition 1 >> cmd" + disk_update_cmd += " && echo shrink desired=DISK_CHANGE_SIZE >> cmd" + disk_update_cmd += " && echo exit >> cmd && diskpart /s cmd" + disk_unit = M + disk_rescan_cmd = "echo rescan > cmd" + disk_rescan_cmd += " && echo exit >> cmd" + disk_rescan_cmd += " && diskpart /s cmd" + virtio_scsi: + driver_name = vioscsi + virtio_blk: + driver_name = viostor + fmt_qcow2: + disk_change_ratio = 1.5 + fmt_raw: + disk_change_ratio = "1.5 0.5" variants: - with_plug: