remote snapshot destruction & replication status zfs property

This commit is contained in:
Christian Schwarz
2018-08-30 11:51:47 +02:00
parent 12dd240b5f
commit 22ca80eb7e
10 changed files with 662 additions and 98 deletions

View 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)
}