Skip to content
Closed
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
3 changes: 3 additions & 0 deletions libvirt/tests/cfg/sriov/vIOMMU/iommu_device_lifecycle.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,6 @@
- reboot_many_times:
loop_time = 5
- reset:
- shutdown:
start_after_shutdown = yes
shutdown_timeout = 60
21 changes: 21 additions & 0 deletions libvirt/tests/src/sriov/vIOMMU/iommu_device_lifecycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,27 @@ def run(test, params, env):
s, o = utils_net.ping(ping_dest, count=5, timeout=10, session=session)
if s:
test.fail("Failed to ping %s! status: %s, output: %s." % (ping_dest, s, o))

elif test_scenario == "shutdown":
test.log.info("TEST_STEP: Shutdown the VM.")
virsh.shutdown(vm.name, **VIRSH_ARGS)
shutdown_timeout = int(params.get("shutdown_timeout", "60"))
if not utils_misc.wait_for(lambda: vm.is_dead(), shutdown_timeout):
test.fail("VM failed to shutdown")
test.log.info("VM successfully shutdown")

# Optional: Start VM again based on parameter
start_after_shutdown = "yes" == params.get("start_after_shutdown", "no")
if start_after_shutdown:
test.log.info("TEST_STEP: Starting VM after shutdown")
vm.start()
vm.cleanup_serial_console()
vm.create_serial_console()
session = vm.wait_for_serial_login(
timeout=int(params.get('login_timeout', 240)))
test.log.info("VM successfully started after shutdown")
session.close()

else:
pid_ping, upsince = save_base.pre_save_setup(vm, serial=True)
if test_scenario == "save_restore":
Expand Down