提交 e5ba2a64 编写于 作者: Y Yiqiao Pu

Merge pull request #313 from spcui/block_resize

qemu.tests.block_resize: Add rescan step after shrink disk for raw forma...
......@@ -82,6 +82,8 @@ def run(test, params, env):
if disk_update_cmd:
disk_update_cmd = disk_update_cmd.split("::")
disk_rescan_cmd = params.get("disk_rescan_cmd")
block_size = data_image_size
disk_change_ratio = params["disk_change_ratio"]
for index, ratio in enumerate(disk_change_ratio.strip().split()):
......@@ -111,9 +113,14 @@ def run(test, params, env):
# We need shrink the disk in guest first, than in monitor
if block_size < old_block_size and disk_update_cmd:
session.cmd(disk_update_cmd[index])
tmp = vm.monitor.block_resize(data_image_dev, block_size)
vm.monitor.block_resize(data_image_dev, block_size)
if need_reboot:
session = vm.reboot(session=session)
elif disk_rescan_cmd:
session.cmd(disk_rescan_cmd)
# We need expand disk in monitor first than extend it in guest
if block_size > old_block_size and disk_update_cmd:
session.cmd(disk_update_cmd[index])
......
......@@ -5,7 +5,7 @@
only qcow2 raw
type = block_resize
images += " stg"
image_size_stg = 15G
image_size_stg = 10G
image_name_stg = images/stg
create_image_stg = yes
force_create_image_stg = yes
......@@ -16,7 +16,7 @@
Windows:
block_size_cmd = wmic diskdrive get size, index
block_size_pattern = "1\s+(\d+)"
accept_ratio = 0.0005
accept_ratio = 0.005
guest_prepare_cmd = "echo select disk 1 > cmd"
guest_prepare_cmd += " && echo online disk noerr >> cmd"
guest_prepare_cmd += " && echo attributes disk clear readonly noerr >> cmd"
......@@ -37,6 +37,9 @@
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"
ide:
# TODO this is bug that ide not support qcow2 format block resize
# recently. Will remove this line when the bug fixed.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册