提交 d9979525 编写于 作者: L Li Jin

balloon_hotplug: hot-unplug balloon device when balloon service is running

hot-unplug balloon device while ballloon service is enabled.
Signed-off-by: NLi Jin <lijin@redhat.com>
上级 72b3e58f
import logging
import time
import re
from virttest.qemu_devices import qdevices
from virttest import error_context
from virttest import utils_test
from qemu.tests import balloon_check
from qemu.tests.balloon_check import BallooningTestWin
@error_context.context_aware
......@@ -14,11 +16,12 @@ def run(test, params, env):
1) Boot up guest w/o balloon device.
2) Hoplug balloon device and check hotplug successfully or not.
3) Do memory balloon.
4) Reboot/shutdown/migrate guest after hotplug balloon device(option)
5) Do memory balloon after guest reboot(option)
6) Unplug balloon device and check unplug successfully or not.
7) Reboot/shutdown/migrate guest after unplug balloon device(option)
3) Install balloon service and check its status in windows guests.
4) Do memory balloon.
5) Reboot/shutdown guest after hotplug balloon device(option)
6) Do memory balloon after guest reboot(option)
7) Unplug balloon device and check unplug successfully or not.
8) Reboot/shutdown guest after unplug balloon device(option)
:param test: QEMU test object.
:param params: Dictionary with the test parameters.
......@@ -36,6 +39,27 @@ def run(test, params, env):
% (pm_test, plug_type), logging.info)
utils_test.run_virt_sub_test(test, params, env, pm_test)
def enable_balloon_service():
"""
Install balloon service and check its status in windows guests
"""
if params['os_type'] != 'windows':
return
error_context.context("Install and check balloon service in windows "
"guest", logging.info)
session = vm.wait_for_login()
driver_name = params.get("driver_name", "balloon")
session = utils_test.qemu.windrv_check_running_verifier(session,
vm, test,
driver_name)
balloon_test = BallooningTestWin(test, params, env)
balloon_test.configure_balloon_service(session)
output = balloon_test.operate_balloon_service(session, "status")
if not re.search(r"running", output.lower(), re.M):
test.error("Ballooon service status is not running")
session.close()
pause = float(params.get("virtio_balloon_pause", 3.0))
pm_test_after_plug = params.get("pm_test_after_plug")
pm_test_after_unplug = params.get("pm_test_after_unplug")
......@@ -70,6 +94,8 @@ def run(test, params, env):
vm.params["balloon_dev_devid"] = "balloon%d" % idx
vm.params["balloon_dev_add_bus"] = "yes"
enable_balloon_service()
error_context.context("Check whether balloon device work after hotplug",
logging.info)
balloon_check.run(test, params, env)
......
......@@ -13,6 +13,18 @@
balloon_type_evict = evict
balloon_type_enlarge = enlarge
balloon_device = virtio-balloon-pci
Windows:
cdroms += " virtio"
# Please change following cdrom_virtio to the right version
# if necessary
cdrom_virtio = isos/windows/virtio-win.iso
# balloon service related cmd, which will be covered by different
# guest's paths in guest-os cfg.
install_balloon_service = "%s:\Balloon\GUEST_OS\amd64\blnsvr.exe -i"
uninstall_balloon_service = "%s:\Balloon\GUEST_OS\amd64\blnsvr.exe -u"
status_balloon_service = "%s:\Balloon\GUEST_OS\amd64\blnsvr.exe status"
run_balloon_service = "%s:\Balloon\GUEST_OS\amd64\blnsvr.exe -r"
stop_balloon_service = "%s:\Balloon\GUEST_OS\amd64\blnsvr.exe -s"
s390x:
balloon_device = virtio-balloon-ccw
variants:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册