From fb0cdde0c23a21a4de7af4d93fc7e66f3a134116 Mon Sep 17 00:00:00 2001 From: xiywang Date: Wed, 7 Dec 2016 14:40:05 +0800 Subject: [PATCH 1/2] Add API for block commit Signed-off-by: xiywang --- virttest/qemu_monitor.py | 52 ++++++++++++++++++++++++++++++++++++++++ virttest/qemu_vm.py | 14 +++++++++++ 2 files changed, 66 insertions(+) diff --git a/virttest/qemu_monitor.py b/virttest/qemu_monitor.py index 2a875650ba..a4289b8f51 100644 --- a/virttest/qemu_monitor.py +++ b/virttest/qemu_monitor.py @@ -907,6 +907,32 @@ def block_stream(self, device, speed=None, base=None, cmd += " %s" % base return self.cmd(cmd) + def block_commit(self, device, speed=None, base=None, top=None, + cmd="block_commit", correct=True): + """ + Start block-commit job + + :param device: device ID + :param speed: int type, limited speed(B/s) + :param base: base file + :param top: top file + :param cmd: block commit job command + :param correct: auto correct command, correct by default + + :return: The command's output + """ + if correct: + cmd = self.correct(cmd) + self.verify_supported_cmd(cmd) + cmd += " %s" % device + if speed: + cmd += " %sB" % speed + if base: + cmd += " %s" % base + if top: + cmd += " %s" % top + return self.cmd(cmd) + def set_block_job_speed(self, device, speed=0, cmd="block_job_set_speed", correct=True): """ @@ -2005,6 +2031,32 @@ def block_stream(self, device, speed=None, base=None, args["base"] = base return self.cmd(cmd, args) + def block_commit(self, device, speed=None, base=None, top=None, + cmd="block-commit", correct=True): + """ + Start block-commit job + + :param device: device ID + :param speed: int type, limited speed(B/s) + :param base: base file + :param top: top file + :param cmd: block commit job command + :param correct: auto correct command, correct by default + + :return: The command's output + """ + if correct: + cmd = self.correct(cmd) + self.verify_supported_cmd(cmd) + args = {"device": device} + if speed: + args["speed"] = speed + if base: + args["base"] = base + if top: + args["top"] = top + return self.cmd(cmd, args) + def set_block_job_speed(self, device, speed=0, cmd="block-job-set-speed", correct=True): """ diff --git a/virttest/qemu_vm.py b/virttest/qemu_vm.py index fdad8a88e5..55abcc5968 100644 --- a/virttest/qemu_vm.py +++ b/virttest/qemu_vm.py @@ -4294,6 +4294,20 @@ def block_stream(self, device, speed, base=None, correct=True): return self.monitor.block_stream(device, speed, base, cmd, correct=correct) + def block_commit(self, device, speed, base=None, top=None, correct=True): + """ + start to commit block device, aka merge snapshot + + :param device: device ID + :param speed: limited speed, default unit B/s + :param base: base file + :param top: top file + :param correct: auto correct cmd, correct by default + """ + cmd = self.params.get("block_commit_cmd", "block-commit") + return self.monitor.block_commit(device, speed, base, top, + cmd, correct=correct) + def block_mirror(self, device, target, sync, correct=True, **kwargs): """ From e27b2c821a72ea2f29ab03289100919ca81b7832 Mon Sep 17 00:00:00 2001 From: xiywang Date: Wed, 7 Dec 2016 15:14:04 +0800 Subject: [PATCH 2/2] Add with_stress in Linux.cfg and Windows.cfg Remove block_stream.with_stress and use with_stress instead Remove drive_mirror.with_stress.heavyload and use with_stress instead Remove drive_mirror.with_stress.dd, confirmed with feature owner Signed-off-by: xiywang --- shared/cfg/guest-os/Linux.cfg | 8 ++++++++ shared/cfg/guest-os/Windows.cfg | 12 +----------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/shared/cfg/guest-os/Linux.cfg b/shared/cfg/guest-os/Linux.cfg index 9690b5dd2c..6b9766ce60 100644 --- a/shared/cfg/guest-os/Linux.cfg +++ b/shared/cfg/guest-os/Linux.cfg @@ -130,3 +130,11 @@ s4_bg_program_kill_cmd = 'pkill ping' s4_log_chk_cmd = 'dmesg | grep -E "ACPI: Waking up from system sleep state S4"\|"ACPI: PCI interrupt for device .* disabled"' s4_start_cmd = 'echo disk > /sys/power/state' + with_stress: + stress_test = autotest_control + test_control_file = stress.control + # Use a low stress to make sure guest can response during stress + control_args = "--cpu 4 --io 4 --vm 2 --vm-bytes 256M" + test_timeout = 1800 + check_cmd = 'pgrep stress' + stop_cmd = "killall -g stress" diff --git a/shared/cfg/guest-os/Windows.cfg b/shared/cfg/guest-os/Windows.cfg index 72f6379295..7c3855f878 100644 --- a/shared/cfg/guest-os/Windows.cfg +++ b/shared/cfg/guest-os/Windows.cfg @@ -295,17 +295,7 @@ post_snapshot_cmd = {monitor:nmi 0} block_stream, drive_mirror: tmp_dir = "C:\" - drive_mirror.with_stress.dd: - #if this link not available, please download from http://www.chrysocome.net/downloads/dd-0.5.zip - download_link = "http://www.chrysocome.net/downloads/dd.exe" - pkg_md5sum = 168b73cc0f3d8c92c98c5028aec770df - install_cmd = 'mkdir "C:\Program Files\dd" && copy /b ${tmp_dir}\dd.exe "C:\Program Files\dd\"' - config_cmd = 'setx path "%path%;C:\Program Files\dd" -m' - app_check_cmd = "dd --list" - start_cmd = "del /f /s /q c:\test.img & dd if=/dev/random of=c:\test.img bs=8k count=250000" - stop_cmd = 'taskkill /F /T /IM dd.exe & del /f /s /q "c:\test.img"' - check_cmd = 'tasklist | findstr /I "dd.exe"' - drive_mirror.with_stress.heavyload, drive_mirror.with_powerdown, block_stream.with_stress: + drive_mirror.with_powerdown: download_link = "http://www.jam-software.com/heavyload/HeavyLoadSetup.exe" pkg_md5sum = 5bf187bd914ac8ce7f79361d7b56bc15 install_cmd = 'start /wait ${tmp_dir}\HeavyLoadSetup.exe /verysilent'