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

Merge pull request #1048 from ybduan/balloon_stress

balloon_stress: add support for Linux guest
......@@ -5,6 +5,7 @@ from virttest import utils_misc
from virttest import utils_test
from virttest import error_context
from qemu.tests.balloon_check import BallooningTestWin
from qemu.tests.balloon_check import BallooningTestLinux
@error_context.context_aware
......@@ -12,24 +13,26 @@ def run(test, params, env):
"""
Qemu balloon device stress test:
1) boot guest with balloon device
2) enable driver verifier in guest
3) reboot guest (optional)
4) check device using right driver in guest.
5) play video in background repeatly
6) balloon memory in monitor in loop
2) enable driver verifier in guest (Windows only)
3) run stress in background repeatly
4) balloon memory in monitor in loop
:param test: QEMU test object
:param params: Dictionary with the test parameters
:param env: Dictionary with test environment.
"""
def run_video():
def run_stress(test, params, env, vm):
"""
Run video in background
Run stress in background
"""
while True:
utils_test.run_virt_sub_test(test, params, env,
params.get("video_test"))
if params['os_type'] == 'windows':
utils_test.run_virt_sub_test(test, params, env,
params.get("stress_test"))
else:
stress_bg = utils_test.VMStress(vm, "stress")
stress_bg.load_stress_tool()
error_context.context("Boot guest with balloon device", logging.info)
vm = env.get_vm(params["main_vm"])
......@@ -38,15 +41,19 @@ def run(test, params, env):
timeout = float(params.get("login_timeout", 360))
session = vm.wait_for_login(timeout=timeout)
driver_name = params["driver_name"]
utils_test.qemu.setup_win_driver_verifier(driver_name, vm, timeout)
if params['os_type'] == 'windows':
driver_name = params["driver_name"]
utils_test.qemu.setup_win_driver_verifier(driver_name, vm, timeout)
error_context.context("Run video background", logging.info)
bg = utils_misc.InterruptedThread(run_video)
balloon_test = BallooningTestWin(test, params, env)
else:
balloon_test = BallooningTestLinux(test, params, env)
error_context.context("Run stress background", logging.info)
bg = utils_misc.InterruptedThread(run_stress, (test, params, env, vm))
bg.start()
repeat_times = int(params.get("repeat_times", 500))
balloon_test = BallooningTestWin(test, params, env)
repeat_times = int(params.get("repeat_times", 1000))
min_sz, max_sz = balloon_test.get_memory_boundary()
error_context.context("balloon vm memory in loop", logging.info)
......@@ -55,7 +62,7 @@ def run(test, params, env):
logging.info("repeat times: %d" % i)
balloon_test.balloon_memory(int(random.uniform(min_sz, max_sz)))
if not bg.is_alive():
test.error("Background video process is not playing")
test.error("Background stress process is not alive")
finally:
if session:
session.close()
......@@ -12,7 +12,7 @@
kill_vm_on_error = yes
check_guest_bsod = yes
run_bgstress = balloon_stress
video_test = win_video_play
stress_test = win_video_play
bg_stress_run_flag = balloon_test
set_bg_stress_flag = yes
free_mem_cmd = wmic os get FreePhysicalMemory
......
- balloon_stress:
type = balloon_stress
virt_test_type = qemu
only Windows
kill_vm = yes
repeat_times = 500
repeat_times = 1000
balloon_timeout = 600
video_test = win_video_play
balloon = balloon0
balloon_dev_devid = balloon0
balloon_dev_add_bus = yes
video_url = http://FILESHARE.COM/pub/section2/kvmauto/video/big_buck_bunny_480p_stereo.avi
x86_64:
program_files = "%ProgramFiles(x86)%"
i386:
program_files = "%ProgramFiles%"
driver_name = "balloon.sys"
#Disable first startup guide for windows media player
wmplayer_reg_cmd = "reg add HKLM\SOFTWARE\Policies\Microsoft\WindowsMediaPlayer /v GroupPrivacyAcceptance /t REG_DWORD /f /d 00000001"
wmplayer_path = "${program_files}\Windows Media Player\wmplayer.exe"
#Install kmplayer if wmplayer is not installed default
kmplayer_install_cmd = "start /wait WIN_UTILS:\kmplayer\%s\KMPlayer-setup.exe /SP- /VERYSILENT"
kmplayer_path = "${program_files}\KMPlayer\kmplayer.exe"
play_video_cmd = '"%s" "%s" /play /fullscreen'
time_for_video = 1200
guest_alias = "Win2008-sp2-32:2k8\x86,Win2008-sp2-64:2k8\amd64,Win2008-r2-64:2k8\amd64,Win2012-64:2k12\amd64,Win2012-64r2:2k12\amd64"
Windows:
stress_test = win_video_play
video_url = http://FILESHARE.COM/pub/section2/kvmauto/video/big_buck_bunny_480p_stereo.avi
x86_64:
program_files = "%ProgramFiles(x86)%"
i386:
program_files = "%ProgramFiles%"
driver_name = "balloon.sys"
#Disable first startup guide for windows media player
wmplayer_reg_cmd = "reg add HKLM\SOFTWARE\Policies\Microsoft\WindowsMediaPlayer /v GroupPrivacyAcceptance /t REG_DWORD /f /d 00000001"
wmplayer_path = "${program_files}\Windows Media Player\wmplayer.exe"
#Install kmplayer if wmplayer is not installed default
kmplayer_install_cmd = "start /wait WIN_UTILS:\kmplayer\%s\KMPlayer-setup.exe /SP- /VERYSILENT"
kmplayer_path = "${program_files}\KMPlayer\kmplayer.exe"
play_video_cmd = '"%s" "%s" /play /fullscreen'
time_for_video = 1200
guest_alias = "Win2008-sp2-32:2k8\x86,Win2008-sp2-64:2k8\amd64,Win2008-r2-64:2k8\amd64,Win2012-64:2k12\amd64,Win2012-64r2:2k12\amd64"
Linux:
# Use a low stress to make sure guest can response during stress
stress_args = "--cpu 4 --io 4 --vm 2 --vm-bytes 256M"
test_timeout = 1800
......@@ -105,7 +105,7 @@
wait_bg_time = 180
free_mem_cmd = wmic os get FreePhysicalMemory
session_cmd_timeout = 240
video_test = win_video_play
stress_test = win_video_play
x86_64:
program_files = "%ProgramFiles(x86)%"
i386:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册