mirror of
https://github.com/zrepl/zrepl.git
synced 2024-11-22 16:34:32 +01:00
26 lines
652 B
Go
26 lines
652 B
Go
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)
|
|
}
|