def get_snapshots(self, dataset=''): """Return snapshots belonging to this context.""" # get all snapshots allsnaps = zfs.get_snapshots(dataset) # sort out those in my context my_snapshots = filter(lambda x: x.startswith('%s-%s-' % (DEFAULT_SNAP_PREFIX, self.tag)), allsnaps) # sort them oldest to newest return sorted(my_snapshots, key=lambda x: self._get_snap_time(x))
def existing_contexts(dataset=''): """Return the set of existing contexts found on the system""" return set([x.split('-')[1] for x in zfs.get_snapshots(dataset) if is_snapman_snapshot(x)])