add xfs support to devicemapper snapshotter

ext4 file system was supported before. This adds support for xfs as
well. Containerd config file can have fs_type as an additional option
with possible values as "xfs" and "ext4" for now. In future other
fstype support can be added. A snapshot created from a committed
snapshot inherits the file system type of the parent. Any new snapshots
that has no parent is created with the file system type indicated in
config. If there is no config for file system type is found, then
ext4 is assumed. This allows users to use xfs as an optional file system
type.

Signed-off-by: Alakesh Haloi <alakeshh@amazon.com>
This commit is contained in:
Alakesh Haloi
2021-07-07 15:06:18 -07:00
parent 3d734d0345
commit 91b64c58b1
4 changed files with 117 additions and 26 deletions

View File

@@ -141,8 +141,14 @@ func testUsage(t *testing.T, snapshotter snapshots.Snapshotter) {
"%d > %d", layer2Usage.Size, sizeBytes)
}
func TestMkfs(t *testing.T) {
func TestMkfsExt4(t *testing.T) {
ctx := context.Background()
err := mkfs(ctx, "")
err := mkfs(ctx, "ext4", "")
assert.ErrorContains(t, err, `mkfs.ext4 couldn't initialize ""`)
}
func TestMkfsXfs(t *testing.T) {
ctx := context.Background()
err := mkfs(ctx, "xfs", "")
assert.ErrorContains(t, err, `mkfs.xfs couldn't initialize ""`)
}