Merge lp:~dave2010/backintime/testhardlink into lp:backintime/1.0

Proposed by Dave
Status: Needs review
Proposed branch: lp:~dave2010/backintime/testhardlink
Merge into: lp:backintime/1.0
Diff against target: 49 lines (+28/-0)
2 files modified
common/snapshots.py (+7/-0)
common/tools.py (+21/-0)
To merge this branch: bzr merge lp:~dave2010/backintime/testhardlink
Reviewer Review Type Date Requested Status
Back In Time Team Pending
Review via email: mp+27986@code.launchpad.net

Description of the change

Add a test to see if the target filesystem supports hardlinks. If it doesn't exit with failure since the point of Back In Time is to support incremental backups. Bug 581614.

To post a comment you must log in.
lp:~dave2010/backintime/testhardlink updated
717. By Dave

Merge from trunk 727

Unmerged revisions

717. By Dave

Merge from trunk 727

716. By Dave

Merge from trunk 719

715. By Dave

Add test for hard link support

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'common/snapshots.py'
2--- common/snapshots.py 2010-07-06 13:32:31 +0000
3+++ common/snapshots.py 2010-07-10 06:50:53 +0000
4@@ -860,6 +860,13 @@
5 os.system( 'sleep 2' ) #max 1 backup / second
6 return [ False, True ]
7
8+ test_path = self.config.get_snapshots_full_path()
9+ if not tools.can_create_hardlinks( test_path ):
10+ logger.error( "Backup filesystem does not support hard links. rsync will be unable to create incremental backups on %s" % test_path )
11+ self.set_take_snapshot_message( 1, _('Backup filesystem does not support hard links. rsync will be unable to create incremental backups on %s') % test_path )
12+ os.system( 'sleep 2' ) #max 1 backup / second
13+ return [ False, True ]
14+
15 new_snapshot_path_to = self.get_snapshot_path_to( new_snapshot_id )
16
17 #create exclude patterns string
18
19=== modified file 'common/tools.py'
20--- common/tools.py 2010-07-04 09:28:54 +0000
21+++ common/tools.py 2010-07-10 06:50:53 +0000
22@@ -372,6 +372,27 @@
23 else:
24 raise
25
26+def can_create_hardlinks( path ):
27+ source_inode = 0
28+ destination_inode = 0
29+ source_path = os.path.join( path, 'tmptestfile-source' )
30+ destination_path = os.path.join( path, 'tmptestfile-destination' )
31+
32+ try:
33+ file = open( source_path, 'w' )
34+ file.close()
35+ source_inode = os.stat( source_path ).st_ino
36+ cmd = "cp -l \"%s\" \"%s\"" % ( source_path, destination_path )
37+ os.system( cmd )
38+ destination_inode = os.stat( destination_path ).st_ino
39+ except:
40+ pass
41+ os.system("rm -f \"%s\" \"%s\"" % ( source_path, destination_path ) )
42+
43+ if source_inode > 0 and source_inode == destination_inode:
44+ return True
45+
46+ return False
47
48 def _get_md5sum_from_path(path):
49 '''return md5sum of path, af available system command md5sum()'''

Subscribers

People subscribed via source and target branches

to all changes: