Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vioser: Supplement the correct function #4212

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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")))
6-dehan marked this conversation as resolved.
Show resolved Hide resolved
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_serial_hotplug_port_pci.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from virttest import env_process, error_context
from virttest import env_process, error_context, qemu_migration
from virttest.qemu_monitor import QMPCmdError

from provider import win_driver_utils
Expand Down Expand Up @@ -34,6 +34,39 @@ def get_buses_and_serial_devices(vm, params, char_devices, serials):
return buses, serial_devices


@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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I don't see the point why we need to implement them again here. Why not from vioser_in_use import live_migration_guest?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what message I got from the maintainer is better to avoid calling case by case.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@6-dehan This is not calling case, just importing independent functions from other module, calling case means you call the run() function in another module. Please help at the maintainer here, we could discuss on it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

globals().get(interrupt_test)(test, params, vm, session) Here is the "calling case by case", if you want to avoid it, this is what you should re-work on. Currently modification of moving those independent functions does not resolve anything.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though, all the functions are steps, e.g. vm.migrate(), vm.reboot(), those are steps instead of a 'case', the test scenario requires this combined steps, I don't see how we can implement it another way.

def run(test, params, env):
"""
Expand Down
Loading