From 4047dfd6fe15d6fb3c19256ec0e52c4dd55076ef Mon Sep 17 00:00:00 2001 From: Sebastian Mitterle Date: Mon, 11 Sep 2023 11:14:16 -0400 Subject: [PATCH] virsh_save/restore: improve tear down 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 --- libvirt/tests/src/virsh_cmd/domain/virsh_restore.py | 2 ++ libvirt/tests/src/virsh_cmd/domain/virsh_save.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/libvirt/tests/src/virsh_cmd/domain/virsh_restore.py b/libvirt/tests/src/virsh_cmd/domain/virsh_restore.py index e54cc21168..9e44215bac 100644 --- a/libvirt/tests/src/virsh_cmd/domain/virsh_restore.py +++ b/libvirt/tests/src/virsh_cmd/domain/virsh_restore.py @@ -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) diff --git a/libvirt/tests/src/virsh_cmd/domain/virsh_save.py b/libvirt/tests/src/virsh_cmd/domain/virsh_save.py index 068d33b476..d8d50cc552 100644 --- a/libvirt/tests/src/virsh_cmd/domain/virsh_save.py +++ b/libvirt/tests/src/virsh_cmd/domain/virsh_save.py @@ -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)