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 f2a458c
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
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
33 changes: 33 additions & 0 deletions qemu/tests/virtio_port_hotplug.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,39 @@
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 f2a458c

Please sign in to comment.