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

@@ -85,18 +85,20 @@ func TestFieldValidation(t *testing.T) {
assert.Assert(t, err != nil)
multErr := (err).(*multierror.Error)
assert.Assert(t, is.Len(multErr.Errors, 3))
assert.Assert(t, is.Len(multErr.Errors, 4))
assert.Assert(t, multErr.Errors[0] != nil, "pool_name is empty")
assert.Assert(t, multErr.Errors[1] != nil, "root_path is empty")
assert.Assert(t, multErr.Errors[2] != nil, "base_image_size is empty")
assert.Assert(t, multErr.Errors[3] != nil, "filesystem type cannot be empty")
}
func TestExistingPoolFieldValidation(t *testing.T) {
config := &Config{
PoolName: "test",
RootPath: "test",
BaseImageSize: "10mb",
PoolName: "test",
RootPath: "test",
BaseImageSize: "10mb",
FileSystemType: "ext4",
}
err := config.Validate()