Skip to content

Commit

Permalink
ADDED support for falling back to transferring full snapshot if lates…
Browse files Browse the repository at this point in the history
…t snapshot (timestamp) does not match on source/destination
  • Loading branch information
masc3d committed May 4, 2016
1 parent 245f8f5 commit 47fbecc
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions btrfs_sxbackup/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -941,17 +941,24 @@ def run(self):
new_snapshot_name = SnapshotName()
if len(self.source.snapshots) > 0 \
and new_snapshot_name.timestamp <= self.source.snapshots[0].name.timestamp:
raise Error('current snapshot name [%s] would be older than newest existing snapshot [%s] \
which may indicate a system time problem'
raise Error(('current snapshot name [%s] would be older than newest existing snapshot [%s] '
'which may indicate a system time problem')
% (new_snapshot_name, self.source.snapshots[0].name))

temp_name = self.source.create_temp_name()

# btrfs send command/subprocess
source_parent_path = None
if len(self.source.snapshots) > 0:
source_parent_path = os.path.join(self.source.container_subvolume_path, str(self.source.snapshots[0].name))
else:
source_parent_path = None
# Latest source and destination snapshot timestamp has to match for incremental transfer
if self.source.snapshots[0].name.timestamp == self.destination.snapshots[0].name.timestamp:
source_parent_path = os.path.join(self.source.container_subvolume_path,
str(self.source.snapshots[0].name))
else:
_logger.warn(
('Latest timestamps of source [%s] and destination [%s] do not match. A full snapshot will '
'be transferred')
% (self.source.snapshots[0].name.timestamp, self.destination.snapshots[0].name.timestamp))

# Create source snapshot
temp_source_path = self.source.create_snapshot(temp_name)
Expand Down

0 comments on commit 47fbecc

Please sign in to comment.