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 24, 2024
1 parent cd9b746 commit 68db74d
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions plugin/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ const (
DeprecationsPlugin = "deprecations"
)

const (
SnapshotterRootDir = "root"
)

// Registration contains information for registering a plugin
type Registration struct {
// Type of the plugin
Expand Down
2 changes: 1 addition & 1 deletion snapshots/btrfs/plugin/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,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
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,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 68db74d

Please sign in to comment.