Skip to content

Commit bd423bf

Browse files
dcantahKern Walster
authored andcommitted
Snapshotters: Export the root path
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 <[email protected]> (cherry picked from commit 32caaee) Signed-off-by: Kern Walster <[email protected]>
1 parent 8fb6bfa commit bd423bf

6 files changed

Lines changed: 9 additions & 2 deletions

File tree

plugin/plugin.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ const (
104104
DeprecationsPlugin = "deprecations"
105105
)
106106

107+
const (
108+
SnapshotterRootDir = "root"
109+
)
110+
107111
// Registration contains information for registering a plugin
108112
type Registration struct {
109113
// Type of the plugin

snapshots/blockfile/plugin/plugin.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ func init() {
6767
opts = append(opts, blockfile.WithMountOptions(config.MountOptions))
6868
}
6969

70+
ic.Meta.Exports[plugin.SnapshotterRootDir] = root
7071
return blockfile.NewSnapshotter(root, opts...)
7172
},
7273
})

snapshots/btrfs/plugin/plugin.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func init() {
5252
root = config.RootPath
5353
}
5454

55-
ic.Meta.Exports = map[string]string{"root": root}
55+
ic.Meta.Exports[plugin.SnapshotterRootDir] = root
5656
return btrfs.NewSnapshotter(root)
5757
},
5858
})

snapshots/devmapper/plugin/plugin.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ func init() {
4747
config.RootPath = ic.Root
4848
}
4949

50+
ic.Meta.Exports[plugin.SnapshotterRootDir] = config.RootPath
5051
return devmapper.NewSnapshotter(ic.Context, config)
5152
},
5253
})

snapshots/native/plugin/plugin.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ func init() {
4848
root = config.RootPath
4949
}
5050

51+
ic.Meta.Exports[plugin.SnapshotterRootDir] = root
5152
return native.NewSnapshotter(root)
5253
},
5354
})

snapshots/overlay/plugin/plugin.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func init() {
6767
oOpts = append(oOpts, overlay.WithMountOptions(config.MountOptions))
6868
}
6969

70-
ic.Meta.Exports["root"] = root
70+
ic.Meta.Exports[plugin.SnapshotterRootDir] = root
7171
return overlay.NewSnapshotter(root, oOpts...)
7272
},
7373
})

0 commit comments

Comments
 (0)