Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

Commit

Permalink
Refactor backup.py to use snapshot name directly in backup process
Browse files Browse the repository at this point in the history
  • Loading branch information
Heavybullets8 committed May 30, 2024
1 parent 2f787a4 commit 20739a2
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions functions/backup_restore/backup/backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,16 +182,17 @@ def backup_all(self):
self.logger.debug(f"max_stream_size_bytes: {self.max_stream_size_bytes}")

if self.backup_snapshot_streams:
snapshot_refer_size = self.snapshot_manager.get_snapshot_refer_size(snapshot_name)
snapshot = f"{dataset_path}@{self.snapshot_name}"
snapshot_refer_size = self.snapshot_manager.get_snapshot_refer_size(snapshot)
self.logger.debug(f"snapshot_refer_size: {snapshot_refer_size}")

if snapshot_refer_size <= self.max_stream_size_bytes:
# Send the snapshot to the backup directory
self.logger.info(f"Sending PV snapshot stream to backup file...")
snapshot_name = f"{dataset_path}@{self.snapshot_name}"
backup_path = app_backup_dir / "snapshots" / f"{snapshot_name.replace('/', '%%')}.zfs"
snapshot = f"{dataset_path}@{self.snapshot_name}"
backup_path = app_backup_dir / "snapshots" / f"{snapshot.replace('/', '%%')}.zfs"
backup_path.parent.mkdir(parents=True, exist_ok=True)
send_result = self.snapshot_manager.zfs_send(snapshot_name, backup_path, compress=True)
send_result = self.snapshot_manager.zfs_send(snapshot, backup_path, compress=True)
if not send_result["success"]:
failures[app_name].append(send_result["message"])
else:
Expand Down

0 comments on commit 20739a2

Please sign in to comment.