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 7c57304 commit e28f0c8
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions libqmpbackup/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,6 @@ def snapshot_rebase(argv):
log.error("No incremental images found, nothing to rebase.")
return False

idx = len(images) - 1

try:
_check(images[0])
except RuntimeError as errmsg:
Expand All @@ -321,6 +319,7 @@ def snapshot_rebase(argv):

if argv.until is not None:
sidx = images_flat.index(argv.until)
print(sidx)

snapshot_cmd = f'qemu-img snapshot -c "FULL-BACKUP" "{images[0]}"'
log.info(snapshot_cmd)
Expand All @@ -332,18 +331,6 @@ def snapshot_rebase(argv):
return False

for image in images[1:]:
idx = idx - 1
if argv.until is not None and idx >= sidx:
log.info("Skipping checkpoint: %s as requested with --until option", image)
continue

if images.index(image) == 0 or "FULL-" in images[images.index(image)]:
log.info(
"Rollback of latest [FULL]<-[INC] chain complete, ignoring older chains"
)
log.info("You can use [%s] to access the latest image data.", link)
break

try:
_check(image)
except RuntimeError as errmsg:
Expand Down Expand Up @@ -374,4 +361,10 @@ def snapshot_rebase(argv):
log.info("Removing: [%s]", image)
os.remove(image)

if argv.until is not None and os.path.basename(image) == argv.until:
log.info(
"Stopping at checkpoint: %s as requested with --until option", image
)
break

return True

0 comments on commit e28f0c8

Please sign in to comment.