Select the most recent backup previous to the date

When restore data with --restore-from-date option from local storage,
The most recent backup subsequent to the specified date will be
selected.

According to the detailed desciptions from README.rst, the
--restore-from-date option will select the most recent backup previous
to the specified date.

The patch fixed the issue.

Change-Id: Iaac936c845ab5ccddd59c751a773e6f190dc064a
Closes-Bug: #1644478
Signed-off-by: Shangzhong Zhu <zhu.shangzhong@zte.com.cn>
This commit is contained in:
Shangzhong Zhu 2016-11-25 11:09:58 +08:00
parent 9efe7e4922
commit 16e68e351a
2 changed files with 2 additions and 2 deletions

View File

@ -101,7 +101,7 @@ class Storage(object):
increments = backup.get_increments()
return {level: backup for level, backup in increments.iteritems()
if not recent_to_date or backup.timestamp >= recent_to_date}
if not recent_to_date or backup.timestamp <= recent_to_date}
def remove_older_than(self, engine, remove_older_timestamp,
hostname_backup_name):

View File

@ -70,7 +70,7 @@ class PhysicalStorage(base.Storage):
level=0) for t in self.listdir(path)]
if recent_to_date:
zeros = [zero for zero in zeros
if zero.timestamp >= recent_to_date]
if zero.timestamp <= recent_to_date]
return zeros
@abc.abstractmethod