Skip to content

Commit

Permalink
Merge pull request #6009 from meinaLi/snapshot
Browse files Browse the repository at this point in the history
Snapshot: fix console failure when using the console for the second time
  • Loading branch information
Yingshun authored Dec 16, 2024
2 parents 32232fb + f10d5e4 commit cdc5c6f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ def run_test_del_parent_snap():
Delete the parent snapshot with multiple children.
"""
test.log.info("TEST_STEP:Delete the parent snapshot with multi-child.")
virsh.start(vm_name)
vm.wait_for_login().close()
if not vm.is_alive():
virsh.start(vm_name)
vm.wait_for_login().close()
del_res = virsh.snapshot_delete(vm.name, snap_names[0], debug=True)
libvirt.check_exit_status(del_res, error_msg)

Expand Down
8 changes: 5 additions & 3 deletions libvirt/tests/src/snapshot/revert_disk_external_snap.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ def revert_snap_and_check_files(params, vm, test, snap_name, expected_files):
"""
virsh.snapshot_revert(vm.name, snap_name, **virsh_dargs)

session = vm.wait_for_login()
vm.cleanup_serial_console()
vm.create_serial_console()
session = vm.wait_for_serial_login()
for file in expected_files:
output = session.cmd('ls %s' % file)
if file not in output:
Expand All @@ -49,8 +51,8 @@ def setup_test():
Prepare file and snapshot.
"""
test.log.info("TEST_SETUP: Create files and snaps in running guest.")
virsh.start(vm_name)
session = vm.wait_for_login()
vm.start()
session = vm.wait_for_serial_login()
mem_file = " "
for index, sname in enumerate(snap_names):
session.cmd("touch %s" % file_list[index])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ def check_file_exist(test, vm, params, revert_snap):

if not vm.is_alive():
virsh.start(vm_name)
session = vm.wait_for_login()
vm.cleanup_serial_console()
vm.create_serial_console()
session = vm.wait_for_serial_login()

if revert_snap == "1":
file_list = eval(params.get("file_list"))[0:1]
Expand Down Expand Up @@ -186,8 +188,8 @@ def run_test():
hotplug disk/hotplug vcpus/blkiotune
"""
test.log.info("TEST_STEP1:Prepare a running guest and create file.")
virsh.start(vm_name)
session = vm.wait_for_login()
vm.start()
session = vm.wait_for_serial_login()
create_file(vm, file_list[0], session)

test.log.info("TEST_STEP2: Create snapshot.")
Expand Down

0 comments on commit cdc5c6f

Please sign in to comment.