mirror of
https://github.com/zrepl/zrepl.git
synced 2025-08-19 03:06:02 +02:00
remote snapshot destruction & replication status zfs property
This commit is contained in:
25
zfs/replication_history.go
Normal file
25
zfs/replication_history.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package zfs
|
||||
|
||||
const ReplicatedProperty = "zrepl:replicated"
|
||||
|
||||
// May return *DatasetDoesNotExist as an error
|
||||
func ZFSGetReplicatedProperty(fs *DatasetPath, v *FilesystemVersion) (replicated bool, err error) {
|
||||
props, err := zfsGet(v.ToAbsPath(fs), []string{ReplicatedProperty})
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
if props.Get(ReplicatedProperty) == "yes" {
|
||||
return true, nil
|
||||
}
|
||||
return false, nil
|
||||
}
|
||||
|
||||
func ZFSSetReplicatedProperty(fs *DatasetPath, v *FilesystemVersion, replicated bool) error {
|
||||
val := "no"
|
||||
if replicated {
|
||||
val = "yes"
|
||||
}
|
||||
props := NewZFSProperties()
|
||||
props.Set(ReplicatedProperty, val)
|
||||
return zfsSet(v.ToAbsPath(fs), props)
|
||||
}
|
Reference in New Issue
Block a user