Skip to content

Conversation

JeffreyDevloo
Copy link
Contributor

No description provided.

Simon Van den Bossche and others added 12 commits March 19, 2019 16:10
Defaults to:
One per hour first day, one per day first week, one per week first month, one older.
Will read `ovs/framework/scheduling/retention_policy/<vdisk_guid>` for config
if different intervals are passed, and will fall back to default if none provided.

Todo:
-Make unittest pass
-Check if config file is in correct format.
Skip the first 24hours when scheduling the task to allow the user to create and use snapshots
Added documentation
Extra checks added to the scheduled task to prevent the policy being enacted on a wrong timestamp
Assertion only triggers on non-unittest environment
@ghost ghost assigned JeffreyDevloo Apr 4, 2019
@JeffreyDevloo JeffreyDevloo changed the title Custom retention policy jef Custom retention policy Apr 4, 2019
- vDisk level: <>

##### Examples:
# @todo more examples
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Work out todo

one snapshot per hour the first day
one snapshot per day the rest of the week
one snapshot per week the rest of the month
one older snapshot snapshot will always be stored for an interval older then the longest interval passed in the config
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is outdated

return 'Snapshot for vDisk {0} ({1})'.format(self.vdisk_guid, ', '.join(prop_strings))


class Bucket(object):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add some more docstrings/typing for this class and its functions.

oldest = snapshot
snapshot_to_keep = oldest
_logger.debug('Elected {} as the snapshot to keep within {}.'.format(snapshot_to_keep, self))
obsolete_snapshots = [s for s in self.snapshots if s.timestamp != snapshot_to_keep.timestamp]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can just compare snapshots here, instead of checking timestamps, right?
[s for s in self.snapshots if s != snapshot_to_keep]

Add API to configure the retention policy
"""
if consistency_first_on is None:
consistency_first_on = []

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do some typechecking here please

# Conflicts:
#	ovs/constants/vdisk.py
#	ovs/lib/generic.py
#	ovs/lib/tests/generic_tests/test_snapshot.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants