Skip to content

Commit

Permalink
..
Browse files Browse the repository at this point in the history
  • Loading branch information
abbbi committed Oct 21, 2024
1 parent 0a8eeae commit 7c57304
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions libqmpbackup/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,12 +322,11 @@ def snapshot_rebase(argv):
if argv.until is not None:
sidx = images_flat.index(argv.until)

print(images[1:])
snapshot_cmd = f'qemu-img snapshot -c "FULL-BACKUP" "{images[0]}"'
log.info(snapshot_cmd)
try:
if not argv.dry_run:
# subprocess.check_output(snapshot_cmd, shell=True)
log.info(snapshot_cmd)
subprocess.check_output(snapshot_cmd, shell=True)
except subprocess.CalledProcessError as errmsg:
log.error("Rebase command failed: [%s]", errmsg)
return False
Expand All @@ -353,7 +352,7 @@ def snapshot_rebase(argv):

try:
snapshot_cmd = (
f'qemu-img snapshot -c "INC-{os.path.basename(image[idx])}" "{image}"'
f'qemu-img snapshot -c "{os.path.basename(image)}" "{images[0]}"'
)
log.info(snapshot_cmd)
rebase_cmd = (
Expand All @@ -363,12 +362,16 @@ def snapshot_rebase(argv):
commit_cmd = "qemu-img commit -b " f'"{images[0]}" ' f'"{image}"'
log.info(commit_cmd)
# subprocess.check_output(commit_cmd, shell=True)
# if not argv.dry_run:
# subprocess.check_output(snapshot_cmd, shell=True)
# subprocess.check_output(rebase_cmd, shell=True)
# subprocess.check_output(commit_cmd, shell=True)
if not argv.dry_run:
subprocess.check_output(snapshot_cmd, shell=True)
subprocess.check_output(rebase_cmd, shell=True)
subprocess.check_output(commit_cmd, shell=True)
except subprocess.CalledProcessError as errmsg:
log.error("Rebase command failed: [%s]", errmsg)
return False

if not argv.dry_run:
log.info("Removing: [%s]", image)
os.remove(image)

return True

0 comments on commit 7c57304

Please sign in to comment.