Skip to content

Commit

Permalink
Merge pull request #2187 from bssrikanth/back_res_image
Browse files Browse the repository at this point in the history
Introduce option to remove backup files
  • Loading branch information
Xu Tian authored Aug 19, 2019
2 parents d26c52c + 12aad60 commit 0a2da01
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions virttest/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,20 @@ def get_backup_set(filename, backup_dir, action, good):
continue
backup_func(src, dst)

def rm_backup_image(self):
"""
Remove backup image
"""
backup_dir = utils_misc.get_path(self.root_dir,
self.params.get("backup_dir", ""))
image_name = os.path.join(backup_dir, "%s.backup" %
os.path.basename(self.image_filename))
logging.debug("Removing image file %s as requested", image_name)
if os.path.exists(image_name):
os.unlink(image_name)
else:
logging.warning("Image file %s not found", image_name)

def save_image(self, params, filename, root_dir=None):
"""
Save images to a path for later debugging.
Expand Down

0 comments on commit 0a2da01

Please sign in to comment.