mirror of
https://github.com/psy0rz/zfs_autobackup.git
synced 2025-04-13 22:47:12 +03:00
wip
This commit is contained in:
parent
87d0354a67
commit
9d594305e3
@ -176,11 +176,11 @@ class Thinner:
|
|||||||
|
|
||||||
return( keeps, removes )
|
return( keeps, removes )
|
||||||
"""
|
"""
|
||||||
|
|
||||||
#keep everything
|
#keep everything
|
||||||
if len(objects)<=self.always_keep:
|
if len(objects)<=self.always_keep:
|
||||||
return ( (objects, []) )
|
return ( (objects, []) )
|
||||||
|
|
||||||
|
|
||||||
#determine time blocks
|
#determine time blocks
|
||||||
time_blocks={}
|
time_blocks={}
|
||||||
for rule in self.rules:
|
for rule in self.rules:
|
||||||
@ -597,7 +597,7 @@ class ZfsDataset():
|
|||||||
|
|
||||||
|
|
||||||
def destroy(self):
|
def destroy(self):
|
||||||
self.debug("Destroying")
|
self.verbose("Destroying")
|
||||||
self.zfs_node.run(["zfs", "destroy", self.name])
|
self.zfs_node.run(["zfs", "destroy", self.name])
|
||||||
self.invalidate()
|
self.invalidate()
|
||||||
self.force_exists=False
|
self.force_exists=False
|
||||||
@ -642,7 +642,7 @@ class ZfsDataset():
|
|||||||
|
|
||||||
#new format:
|
#new format:
|
||||||
time_secs=time.mktime(time.strptime(time_str,"%Y%m%d%H%M%S"))
|
time_secs=time.mktime(time.strptime(time_str,"%Y%m%d%H%M%S"))
|
||||||
return(time_str)
|
return(time_secs)
|
||||||
|
|
||||||
|
|
||||||
def from_names(self, names):
|
def from_names(self, names):
|
||||||
@ -889,7 +889,6 @@ class ZfsDataset():
|
|||||||
#now let thinner decide what we want on both sides
|
#now let thinner decide what we want on both sides
|
||||||
self.verbose("Create thinning list")
|
self.verbose("Create thinning list")
|
||||||
(source_keeps, source_obsoletes)=self.thin(keeps=[self.our_snapshots[-1]])
|
(source_keeps, source_obsoletes)=self.thin(keeps=[self.our_snapshots[-1]])
|
||||||
p(source_obsoletes)
|
|
||||||
(target_keeps, target_obsoletes)=target_dataset.thin(keeps=[target_dataset.our_snapshots[-1]])
|
(target_keeps, target_obsoletes)=target_dataset.thin(keeps=[target_dataset.our_snapshots[-1]])
|
||||||
|
|
||||||
#stuff that is before common snapshot can be deleted rightaway
|
#stuff that is before common snapshot can be deleted rightaway
|
||||||
@ -918,7 +917,7 @@ class ZfsDataset():
|
|||||||
if target_snapshot in target_keeps:
|
if target_snapshot in target_keeps:
|
||||||
source_snapshot.transfer_snapshot(target_snapshot, prev_snapshot=prev_source_snapshot, show_progress=show_progress)
|
source_snapshot.transfer_snapshot(target_snapshot, prev_snapshot=prev_source_snapshot, show_progress=show_progress)
|
||||||
else:
|
else:
|
||||||
source.snapshot.verbose("skipped (target doesnt need it)")
|
source_snapshot.verbose("skipped (target doesnt need it)")
|
||||||
|
|
||||||
#we may destroy the previous snapshot now, if we dont want it anymore
|
#we may destroy the previous snapshot now, if we dont want it anymore
|
||||||
if prev_source_snapshot and (prev_source_snapshot not in source_keeps):
|
if prev_source_snapshot and (prev_source_snapshot not in source_keeps):
|
||||||
@ -949,7 +948,7 @@ class ZfsNode(ExecuteNode):
|
|||||||
else:
|
else:
|
||||||
self.verbose("Keep all snapshots forver.")
|
self.verbose("Keep all snapshots forver.")
|
||||||
|
|
||||||
self.thinner=Thinner()
|
self.thinner=thinner
|
||||||
|
|
||||||
ExecuteNode.__init__(self, ssh_to=ssh_to, readonly=readonly, debug_output=debug_output)
|
ExecuteNode.__init__(self, ssh_to=ssh_to, readonly=readonly, debug_output=debug_output)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user