Skip to content

Commit

Permalink
Snapshotters: Export the root path
Browse files Browse the repository at this point in the history
Some of the snapshotters that allow you to change their root location
were already doing this, this just makes all of them follow the same
pattern.

Signed-off-by: Danny Canter <danny@dcantah.dev>
(cherry picked from commit 32caaee)
Signed-off-by: Kern Walster <walster@amazon.com>
  • Loading branch information
dcantah authored and Kern-- committed Apr 18, 2024
1 parent 8fb6bfa commit bd423bf
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 2 deletions.
4 changes: 4 additions & 0 deletions plugin/plugin.go
Expand Up @@ -104,6 +104,10 @@ const (
DeprecationsPlugin = "deprecations"
)

const (
SnapshotterRootDir = "root"
)

// Registration contains information for registering a plugin
type Registration struct {
// Type of the plugin
Expand Down
1 change: 1 addition & 0 deletions snapshots/blockfile/plugin/plugin.go
Expand Up @@ -67,6 +67,7 @@ func init() {
opts = append(opts, blockfile.WithMountOptions(config.MountOptions))
}

ic.Meta.Exports[plugin.SnapshotterRootDir] = root
return blockfile.NewSnapshotter(root, opts...)
},
})
Expand Down
2 changes: 1 addition & 1 deletion snapshots/btrfs/plugin/plugin.go
Expand Up @@ -52,7 +52,7 @@ func init() {
root = config.RootPath
}

ic.Meta.Exports = map[string]string{"root": root}
ic.Meta.Exports[plugin.SnapshotterRootDir] = root
return btrfs.NewSnapshotter(root)
},
})
Expand Down
1 change: 1 addition & 0 deletions snapshots/devmapper/plugin/plugin.go
Expand Up @@ -47,6 +47,7 @@ func init() {
config.RootPath = ic.Root
}

ic.Meta.Exports[plugin.SnapshotterRootDir] = config.RootPath
return devmapper.NewSnapshotter(ic.Context, config)
},
})
Expand Down
1 change: 1 addition & 0 deletions snapshots/native/plugin/plugin.go
Expand Up @@ -48,6 +48,7 @@ func init() {
root = config.RootPath
}

ic.Meta.Exports[plugin.SnapshotterRootDir] = root
return native.NewSnapshotter(root)
},
})
Expand Down
2 changes: 1 addition & 1 deletion snapshots/overlay/plugin/plugin.go
Expand Up @@ -67,7 +67,7 @@ func init() {
oOpts = append(oOpts, overlay.WithMountOptions(config.MountOptions))
}

ic.Meta.Exports["root"] = root
ic.Meta.Exports[plugin.SnapshotterRootDir] = root
return overlay.NewSnapshotter(root, oOpts...)
},
})
Expand Down

0 comments on commit bd423bf

Please sign in to comment.