Merge pull request #9009 from dcantah/block-file-recreate

Blockfile: Expose RecreateScratch option
This commit is contained in:
Derek McGowan 2023-08-28 11:53:56 -07:00 committed by GitHub
commit c0111909a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -37,6 +37,10 @@ type Config struct {
// MountOptions are options used for the mount // MountOptions are options used for the mount
MountOptions []string `toml:"mount_options"` MountOptions []string `toml:"mount_options"`
// RecreateScratch always recreates the specified `ScratchFile`
// on initialization of the plugin instead of using an existing.
RecreateScratch bool `toml:"recreate_scratch"`
} }
func init() { func init() {
@ -66,6 +70,7 @@ func init() {
if len(config.MountOptions) > 0 { if len(config.MountOptions) > 0 {
opts = append(opts, blockfile.WithMountOptions(config.MountOptions)) opts = append(opts, blockfile.WithMountOptions(config.MountOptions))
} }
opts = append(opts, blockfile.WithRecreateScratch(config.RecreateScratch))
return blockfile.NewSnapshotter(root, opts...) return blockfile.NewSnapshotter(root, opts...)
}, },