Skip to content

Commit

Permalink
Merge pull request #5168 from smitterl/fix_vdisks
Browse files Browse the repository at this point in the history
startup_policy: fix teardown
  • Loading branch information
chunfuwen authored Sep 18, 2023
2 parents e4a6667 + c1ba24a commit 6b8c404
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions libvirt/tests/src/virtual_disks/startup_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
# Using as lower capital is not the best way to do, but this is just a
# workaround to avoid changing the entire file.
logging = log.getLogger('avocado.' + __name__)
new_source_file = ""


def run(test, params, env):
Expand Down Expand Up @@ -282,8 +283,10 @@ def update_source_policy(update=True, policy='optional'):
:param update: update value or not
:param policy: policy value
:return: flag_option and boolean value
and new_source_file path
"""
source_file = policy_item.get('file')
global new_source_file
if update:
new_source_file = source_file+".empty"
else:
Expand Down Expand Up @@ -518,5 +521,9 @@ def rename_file(source_file, target_file, revert=False):
os.remove(disk_xml_file)
if os.path.exists(media_file):
os.remove(media_file)
if os.path.exists(media_file_new):
os.remove(media_file_new)
if os.path.exists(new_source_file):
os.remove(new_source_file)
if os.path.exists(disk_xml_policy_file):
os.remove(disk_xml_policy_file)

0 comments on commit 6b8c404

Please sign in to comment.