from bisect import insort, bisect_left
from time_slider import util, zfs, dbussvc, autosnapsmf, timeslidersmf
from bisect import insort, bisect_left
from time_slider import util, zfs, dbussvc, autosnapsmf, timeslidersmf
lockFile = os.path.join(lockFileDir, tail)
if not os.path.exists(lockFileDir):
lockFile = os.path.join(lockFileDir, tail)
if not os.path.exists(lockFileDir):
try:
lockFp = open(lockFile, 'w')
fcntl.flock(lockFp, fcntl.LOCK_EX | fcntl.LOCK_NB)
try:
lockFp = open(lockFile, 'w')
fcntl.flock(lockFp, fcntl.LOCK_EX | fcntl.LOCK_NB)
trashDir = os.path.join(trash, tail)
if not os.path.exists(trash):
trashDir = os.path.join(trash, tail)
if not os.path.exists(trash):
util.debug("Deleting rsync backup to recover space: %s"\
% (dirName), self._verbose)
util.debug("Deleting rsync backup to recover space: %s"\
% (dirName), self._verbose)
self._bus.rsync_started(self._rsyncBaseDir)
ctime,snapName = self._currentQueueSet[0]
self._bus.rsync_started(self._rsyncBaseDir)
ctime,snapName = self._currentQueueSet[0]
# Make sure the snapshot didn't get destroyed since we last
# checked it.
remainingList = self._currentQueueSet[1:]
# Make sure the snapshot didn't get destroyed since we last
# checked it.
remainingList = self._currentQueueSet[1:]
# Add the new directory to our internal
# mtime dictionary and sorted list.
self._backupTimes[targetDir] = {}
insort(self._backupDirs, targetDir)
else:
# Add the new directory to our internal
# mtime dictionary and sorted list.
self._backupTimes[targetDir] = {}
insort(self._backupDirs, targetDir)
else:
# Set umask temporarily so that rsync backups are read-only to
# the owner by default. Rync will override this to match the
# permissions of each snapshot as appropriate.
# Set umask temporarily so that rsync backups are read-only to
# the owner by default. Rync will override this to match the
# permissions of each snapshot as appropriate.
util.debug("Starting rsync backup of '%s' to: %s" \
% (sourceDir, partialDir),
self._verbose)
util.debug("Starting rsync backup of '%s' to: %s" \
% (sourceDir, partialDir),
self._verbose)
# they match the snapshot creation time. This is extremely important
# because the backup mechanism relies on it to determine backup times
# and nearest matches for incremental rsync (linkDest)
# they match the snapshot creation time. This is extremely important
# because the backup mechanism relies on it to determine backup times
# and nearest matches for incremental rsync (linkDest)
- self._backupTimes[targetDir][snapshot.snaplabel] = long(ctime)
- insort(self._backups, [long(ctime), os.path.abspath(backupDir)])
+ self._backupTimes[targetDir][snapshot.snaplabel] = int(ctime)
+ insort(self._backups, [int(ctime), os.path.abspath(backupDir)])
snapshot.set_user_property(self._propName, "completed")
snapshot.release(self._propName)
self._currentQueueSet = remainingList
snapshot.set_user_property(self._propName, "completed")
snapshot.release(self._propName)
self._currentQueueSet = remainingList
for mtime,dirName in purgeList:
trashDir = os.path.join(trash,
dirName)
for mtime,dirName in purgeList:
trashDir = os.path.join(trash,
dirName)
outdata,errdata = util.run_command(cmd)
for line in outdata.rstrip().split('\n'):
ctimeStr,name = line.split()
outdata,errdata = util.run_command(cmd)
for line in outdata.rstrip().split('\n'):
ctimeStr,name = line.split()
lockFile = os.path.join(lockFileDir, 'rsync-backup.lock')
lockFp = open(lockFile, 'w')
lockFile = os.path.join(lockFileDir, 'rsync-backup.lock')
lockFp = open(lockFile, 'w')