Skip to content

Commit

Permalink
vioser: Supplement the correct function
Browse files Browse the repository at this point in the history
Avoid case calling case, so add corresponding functions

Signed-off-by: Dehan Meng <[email protected]>
  • Loading branch information
6-dehan committed Nov 21, 2024
1 parent bcd89cd commit 6802507
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
10 changes: 10 additions & 0 deletions qemu/tests/vioser_in_use.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ def live_migration_guest(test, params, vm, session):
vm.migrate()


def subw_guest_pause_resume(test, params, vm, session):
vm.monitor.cmd("stop")
if not vm.monitor.verify_status("paused"):
test.error("VM is not paused Current status: %s" % vm.monitor.get_status())
time.sleep(float(params.get("wait_timeout", "1800")))
vm.monitor.cmd("cont")
if not vm.monitor.verify_status("running"):
test.error("VM is not running. Current status: %s" % vm.monitor.get_status())


@error_context.context_aware
def vcpu_hotplug_guest(test, params, vm, session):
"""
Expand Down
35 changes: 34 additions & 1 deletion qemu/tests/virtio_port_hotplug.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,46 @@
import time

from avocado.utils import process
from virttest import error_context, utils_test
from virttest import error_context, utils_test, qemu_migration

from provider import win_driver_utils
from qemu.tests.vioser_in_use import run_bg_test
from qemu.tests.virtio_serial_file_transfer import transfer_data


@error_context.context_aware
def reboot_guest(test, params, vm, session):
"""
Reboot guest from system_reset or shell.
"""

vm.reboot(session, method=params["reboot_method"])


@error_context.context_aware
def shutdown_guest(test, params, vm, session):
"""
Shutdown guest via system_powerdown or shell.
"""

if params.get("shutdown_method") == "shell":
session.sendline(params["shutdown_command"])
elif params.get("shutdown_method") == "system_powerdown":
vm.monitor.system_powerdown()
if not vm.wait_for_shutdown(int(params.get("shutdown_timeout", 360))):
test.fail("guest refuses to go down")


@error_context.context_aware
def live_migration_guest(test, params, vm, session):
"""
Run migrate_set_speed, then migrate guest.
"""

qemu_migration.set_speed(vm, params.get("mig_speed", "1G"))
vm.migrate()


@error_context.context_aware
def run(test, params, env):
"""
Expand Down

0 comments on commit 6802507

Please sign in to comment.