zfs send/recv: Support raw sends (-w/-Lce) and property handling (-p, -b, -o, -x)
Signed-off-by: InsanePrawn <insane.prawny@gmail.com>
This commit is contained in:
+35
-4
@@ -12,6 +12,8 @@ import (
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/zrepl/yaml-config"
|
||||
|
||||
zfsprop "github.com/zrepl/zrepl/zfs/property"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
@@ -76,8 +78,15 @@ type SnapJob struct {
|
||||
}
|
||||
|
||||
type SendOptions struct {
|
||||
Encrypted bool `yaml:"encrypted"`
|
||||
StepHolds SendOptionsStepHolds `yaml:"step_holds,optional"`
|
||||
|
||||
Encrypted bool `yaml:"encrypted,optional"`
|
||||
Raw bool `yaml:"raw,optional"`
|
||||
SendProperties bool `yaml:"send_properties,optional"`
|
||||
BackupProperties bool `yaml:"backup_properties,optional"`
|
||||
LargeBlocks bool `yaml:"large_blocks,optional"`
|
||||
Compressed bool `yaml:"compressed,optional"`
|
||||
EmbeddedData bool `yaml:"embbeded_data,optional"`
|
||||
}
|
||||
|
||||
type SendOptionsStepHolds struct {
|
||||
@@ -87,21 +96,43 @@ type SendOptionsStepHolds struct {
|
||||
var _ yaml.Defaulter = (*SendOptions)(nil)
|
||||
|
||||
func (l *SendOptions) SetDefault() {
|
||||
*l = SendOptions{Encrypted: false}
|
||||
*l = SendOptions{
|
||||
Encrypted: false,
|
||||
Raw: false,
|
||||
SendProperties: false,
|
||||
BackupProperties: false,
|
||||
LargeBlocks: false,
|
||||
Compressed: false,
|
||||
EmbeddedData: false,
|
||||
}
|
||||
}
|
||||
|
||||
type RecvOptions struct {
|
||||
// Note: we cannot enforce encrypted recv as the ZFS cli doesn't provide a mechanism for it
|
||||
// Encrypted bool `yaml:"may_encrypted"`
|
||||
|
||||
// Future:
|
||||
// Reencrypt bool `yaml:"reencrypt"`
|
||||
|
||||
Properties *PropertyRecvOptions `yaml:"properties,fromdefaults"`
|
||||
}
|
||||
|
||||
var _ yaml.Defaulter = (*RecvOptions)(nil)
|
||||
|
||||
func (l *RecvOptions) SetDefault() {
|
||||
*l = RecvOptions{}
|
||||
*l = RecvOptions{Properties: &PropertyRecvOptions{}}
|
||||
}
|
||||
|
||||
type PropertyRecvOptions struct {
|
||||
Inherit []zfsprop.Property `yaml:"inherit,optional"`
|
||||
Override map[zfsprop.Property]string `yaml:"override,optional"`
|
||||
}
|
||||
|
||||
var _ yaml.Defaulter = (*PropertyRecvOptions)(nil)
|
||||
|
||||
func (l *PropertyRecvOptions) SetDefault() {
|
||||
//*l = PropertyRecvOptions{}
|
||||
//TODO: is below necessary?
|
||||
*l = PropertyRecvOptions{Inherit: make([]zfsprop.Property, 0), Override: make(map[zfsprop.Property]string)}
|
||||
}
|
||||
|
||||
type PushJob struct {
|
||||
|
||||
Reference in New Issue
Block a user