Skip to content

Commit

Permalink
virsh_save/restore: improve tear down
Browse files Browse the repository at this point in the history
If save.file exists, remove it. If not, it can lead to test errors
"Permission denied" or "right command failed" and similar issues.

Signed-off-by: Sebastian Mitterle <[email protected]>
  • Loading branch information
smitterl committed Sep 11, 2023
1 parent 9efa4d2 commit 4047dfd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions libvirt/tests/src/virsh_cmd/domain/virsh_restore.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,3 +216,5 @@ def check_file_own(file_path, exp_uid, exp_gid):
export_dir=params.get("export_dir"), rm_export_dir=False)
if setup_iscsi:
libvirt.setup_or_cleanup_iscsi(False)
if os.path.exists(tmp_file):
os.remove(tmp_file)
2 changes: 2 additions & 0 deletions libvirt/tests/src/virsh_cmd/domain/virsh_save.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,3 +155,5 @@ def create_alter_xml(vm_name):
finally:
if vm.is_paused():
virsh.resume(vm_name)
if os.path.exists(savefile):
os.remove(savefile)

0 comments on commit 4047dfd

Please sign in to comment.